Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top