I have created .NET solution with Visual Studio 2012 Package Project (From VS2012 SDK). With Visual Studio I successfully compile and run this project (along with entire solution) in "Debug" configuration mode, and for "Any CPU" platform. But when I try to build solution in command line using MsBuild, I get errors:
Command:
msbuild MySolution.sln /p:Configuration=Debug /p:Platform="Any CPU"
Errors:
error : Can not find the installation for VS SDK.
error MSB4018: The "FindVsSDKInstallation" task fail
ed unexpectedly.
error MSB4018: System.ArgumentNullException: Value can
not be null.
error MSB4018: Parameter name: path1
error MSB4018: at System.IO.Path.Combine(String pat
h1, String path2)
error MSB4028: The "FindVsSDKInstallation" task's ou
tputs could not be retrieved from the "IncludesPath" parameter. Value cannot be
null.
error MSB4028: Parameter name: path1
All activities are performed on my local Windows 7, with VS2012 and SDK installed.
I was looking for solution on the Web and I have found the following topic: FindVsSDKInstallation task fails on the build box. There is said that such a project should be compiled for "x86" platform, because devenv.exe
process is 32-bit. So I change a Platform Target
property from Project Properties to "x86" (for "Debug" mode). The result is the same - project is built successfully in VS but not in MsBuild
.
Why VS2012 Package project is properly built by using VS, but MsBuild
fails? How should I run MsBuild
to build it successfully?
First, you need to use a visual studio command prompt, or call the vsvars batch file e.g. "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\vsvars32.bat"
Second, the link you gave also says
There's a related post here