Invalid file names when trying to deploy SSDT project with TeamCity 8

旧巷老猫 提交于 2019-12-12 13:18:10

问题


I am trying to deploy Visual Studio 2012 SSDT project to Sql Server using TeamCity 8 and MSBuild Publish task but the deployment fails.

When I look at TeamCity logs and use /v:diag switch in my build configuration I see that for unknown reason MSBuild searches for MyProject.sqlproj.publish.sql and for MyProject.sqlproj.dacpac files.

The exact error:

[SqlPublishTask] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(1233, 5): File "C:\Program Files\TeamCity\buildAgent\work\abf8bc05a2cfe7f\*MyProject*\bin\Debug\*MyProject*.sqlproj.dacpac" does not exist.

The correct .sql and .dacpac files get generated (without the .sqlproj in the middel) in buildAgent/work/identificator/*MySolution*/MyProject/bin/Debug folder.

My TeamCity build step is configured as follows:

  • Runner type: MSbuild
  • Build file path: MyProject/*MyProject*.sqlproj
  • MSBuild version: 4.5
  • MsBuild ToolsVersion: 4.0
  • Run platform: 4.0
  • Targets: Publish
  • Command line parameters: /p:SqlPublishProfilePath="Debug.publish.xml" /p:Configuration=Debug

If I execute this from commandline I get no errors.

Any ideas on how can I configure TeamCity to search for correct files or configure my project to generate the files that TeamCity is searching for.

Or is my plan to use MSBuild's Publish task futile and I should utilise sqlpackage.exe instead?

UPDATE

After spending almost three days trying to figure this out I gave up and used sqlpackage.exe which works like a charm. But I would still be interested in an answer though, passing paths to executables in build servers seems a bit crude way to accomplish things.


回答1:


I had a similar issue and came to the conclusion that the way TeamCity produces "pseudo-project" files with *.teamcity suffixes is confusing something in the MSBuild/SSDT target chain.

I simply replaced the MSBuild runner build step with a pure Command Line step and the problem went away.

We lose the user friendliness of the TeamCity MSBuild runner configuration, but if it works, it's a compromise I'm willing to make.

Note - we are running TeamCity 7 - I am not sure if this has been addressed in later versions.




回答2:


I found out you can set a System Property named "system.SqlTargetName" on the build configuration to override the default value.

Setting this to your project name without the ".sqlproj" makes the error go away.



来源:https://stackoverflow.com/questions/17857927/invalid-file-names-when-trying-to-deploy-ssdt-project-with-teamcity-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!