I am trying to build and deploy a .NET 4 project using MSBuild Web Deploy and TeamCity, I got this working fine (eventually) with an instance of TeamCity running on my local development machine, however when I tried to set up a fresh TeamCity instance with the same settings I got the following error:
\Microsoft.Common.targets(2249, 9): error MSB3086: Task could not find "sgen.exe"
using the SdkToolsPath
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\" or the
registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A".
Make sure the SdkToolsPath is set and the tool exists in the correct processor
specific location under the SdkToolsPath and that the Microsoft Windows SDK
is installed
I’m running Windows Server 2008, and have .NET 4 installed, including (I believe) MSBuild 4. I’ve also installed Windows SDK 7.1 as other threads suggested this may be the problem, but still no luck. Any ideas or advice would be appreciated.
Thanks
There is/was something wonky about the way the windows SDK 7.0A installs with verus without visual studio. There are pathing issues. Easy way out is to install Visual Studio on the build machine, but that feels wrong. Or at least it does to me. Another option is to set your builds not to create the serialization assemblies — they don’t matter in many cases. Note that if you skip release builds this happens by default.
Real fix is to properly point TeamCity at sgen.exe and then tell msbuild to use the right folder by using the right toolspath. See this question for a good explanation.