-2

Error Encountered

error MSB3091: Task failed because "sgen.exe" was not found, or the .NET Framework SDK v2.0 is not installed. The task is looking for "sgen.exe" in the "bin" subdirectory beneath the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework. You may be able to solve the problem by doing one of the following: 1.) Install the .NET Framework SDK v2.0.
2.) Manually set the above registry key to the correct location. 3.) Pass the correct location into the "ToolPath" parameter of the task.

Installed .NET 2.0 SDK and also copied the sgen.exe (from:C:\Program Files\Microsoft.NET\SDK\v2.0 64bit) to the C:\Windows\Microsoft.NET\Framework64\v2.0.50727 Still not able to build. Please help.

2 Answers2

2

To resolve this issue, please try to set the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A InstallationFolder key to the same path as the 2.0 Sdk path.

See Task failed because "sgen.exe" was not found for some more details.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
1

I was able to resolve the issue by adding the following line in the .csproj file.

<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>