问题
I wondered if someone could perhaps help save my sanity by telling me what I'm missing here. The background first.
We have 5 database projects in TC, each with a build step and then a deploy step. 4 out of these 5 projects build and deploy perfectly.
The 5th however build ok but then raises the following error during deployment to the its SQL Server;
"*** An error occurred during deployment plan generation. Deployment cannot continue."
The Element or Annotation class PersistedResolvableAnnotation does not contain the Property class Length.
[08:32:52][Exec] C:\TeamCity\BuildAgent3\work\c3c1bdeecddf68ca.Build\dbdeploy_single.proj(9, 5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft SQL Server\120\DAC\Bin\sqlpackage.exe" /Action:Publish /sf:"../DB-ExampleData/ExampleData/bin/Release/ExampleData.dacpac" /pr:"../DB-ExampleData/ExampleData/UAT.publish.xml" /TargetServerName:IP.IP.IP.111" exited with code 1.
During my investigation I compared the UAT.publish.xml to one that works and they seem identical. I've tried Windows Authentication and SQL Authentication and that makes no difference either. The publish file works fine when run from within Visual Studio as well.
I've checked the deploy settings between the projects that work and this one and the only difference I can see is in the database name which is expected.
Has anyone got any ideas on what this may be caused by and how I can resolve it. I have logs and screenshots if needed.
Thanks for taking the time to read this.
Nic
回答1:
It looks as if your build server has a different version of sqlpackage (i.e. DacFX) than the one that Visual Studio is using, and only one of your five projects contains whatever feature is handled "differently" by the two versions.
There's a bit of detail in this msdn thread.
In short, I'd be updating DacFX on the build server, and making sure the build job is calling the sqlpackage.exe
that is in
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130
回答2:
In my case SQLCLR on .NET version was different in the project Properties. Thanks @Gavin for pointing on right direction. And corrected "Compatibility Level"
来源:https://stackoverflow.com/questions/40628071/database-deployment-an-error-occurred-during-deployment-plan-generation-deplo