Pages - Menu

MSBuild Error: Task could not find "sgen.exe" using the SdkToolsPath


I am getting an error when trying to build in release mode for one of my project. The error looks like this in Visual Studio 2012.

Task could not find "sgen.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86". 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

Step In

Search around on the internet, it appears that sgen.exe is an XML Serializer Generator Tool (MSDN). It appears to me that I have 2 solutions.


Disable "Generate serialization assembly"

If we turn off "Generate serialization assembly", then the compiler will not be looking for sgen.exe to precompile the serialization assembly.

Locate sgen.exe

A better solution would be fix the sgen.exe so that VS can find it.

At an attempt to locate this sgen.exe for VS, I tried to download and install the following.
  • Microsoft Visual Studio 2012 SDK
  • Microsoft .NET Framework 4 (Web Installer)
  • Microsoft .NET Framework 4.5
Unfortunately, none of the above works except the below.
The v8.0A in the error message was a good hint of something about Windows 8


Finally, able to deploy from my machine in release mode for now. Until next time, I am sure I will run into similar issue again when building a continuous integration process and this article should come into handy.

No comments:

Post a comment