Database msbuild publish not working from command line
Asked Answered
A

1

7

I am trying to Publish a .sqlproj from command line with MSBuild with the command: msbuild /t:Publish [MySqlProjPath] but i get the following error:

error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

What i find weird is that from Visual Studio 2012 i can Publish the same project successfully. Does Visual Studio set any magical msbuild property before publishing to get the .targets file from another directory?

Argue answered 19/8, 2013 at 12:57 Comment(0)
E
12

You should pass the following argument to MSBuild:

/p:VisualStudioVersion=11.0 /t:Rebuild;Publish 

This tells msbuild to use VS2012 targets.

Passing VisualStudioVersion is required hence VS2010 and Vs2012 can share the same project file: i.e. project file does not store target VS version inside itself

Erena answered 19/8, 2013 at 13:12 Comment(1)
Thats awesome, works like a charm some of my solution is expecting 2013 components, this fixed it /p:VisualStudioVersion=11.0Reputation

© 2022 - 2024 — McMap. All rights reserved.