Reputation: 111
My situation is a bit complex, I hope I can explain it correctly: I have a Visual Studio solution which I'm using to build a WiX installer. This installer, among other things, deploys an SQL DB schema through a dacpac. This dacpac is generated by an SQL Server 2014 project in the same solution.
Currently the installation fails when it reaches the step where it needs to deploy the generated dacpac. The error is the following:
Microsoft.Data.Tools.Schema.Sql.Deployment.DeploymentFailedException: The Element or Annotation class PersistedResolvableAnnotation does not contain the Property class Length. --->
Microsoft.Data.Tools.Schema.SchemaModel.ModelSerializationException: The Element or Annotation class PersistedResolvableAnnotation does not contain the Property class Length.
This is a similar situation to the one described in this thread Latest SSDT vs. SqlPackage incompatibility for SQL Server 2014, except that I'm not deploying the dacpac using SqlPackage.exe, but the WiX installer is doing it, so the solution of using a newer SqlPackage.exe version doesn't work for me.
Also, the Custom Action project from my solution, which deploys the dacpac file is bound to .net 4.5.1. This is a product constraint, so using a newer .net version is not a solution for me either.
<package id="Microsoft.DataTierAppFramework" version="12.0.1295" targetFramework="net451" />
The incompatibility comes from the fact that the dacpac file gets somehow generated against a newer Data.Tools.Schema version. Extract from Origin.xml in the dacpac:
<ProductName>Microsoft.Data.Tools.Schema.Tasks.Sql, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</ProductName>
<ProductVersion>14.0.60519.0</ProductVersion>
This causes the model.xml from the dacpac file to include some fancy tags that version 12 of Microsoft.Data.Tools.Schema.Sql.Deployment used by the deployment Custom Action does not understand (as shown in the error message).
So I'm figuring that my only solution would be to explicitly tell Visual Studio to generate the dacpac file using version 12 of Data.Tools.Schema instead of it choosing version 14 by default, but I haven't found any place in the DB project properties where the version of the Data.Tools.Schema can be specified. I imagine VS just gets the latest DAC version it can find on the build machine and generates the dacpac based on that.
Does anyone know how this can be done? Or is there another solution that I'm not seeing at the moment?
Upvotes: 0
Views: 1162
Reputation: 796
In the database project, go to the tab Project -> properties ...
In Project Settings, select the appropriate Target platform.
For example, SQL Server 2017 will generate dacpac version 14. For version 12, select SQL Server 2014.
Save settings and recompile the project.
Upvotes: 0