Search code examples
visual-studio-2013.net-4.5.net-framework-version.net-4.6

Unable to publish project in release mode in Visual studio VS 2013 professional?


I am unable to publish my project in release mode in Visual Studio 2013 professional. I have recently changed the .net framework of the project to 4.6 from 4.5 and to simulate the dev environment with Test and production environment, i have uninstalled the .Net Framework 4.5 and 4.5.1 SDK from dev machine and have only 4.6.1 framework installed.

Note : .Net Framework 4.5 and 4.5.1 Target Packs are available in the machine to be used by Visual studio.

When i publish the project in release mode gives the following error :

Task could not find "sgen.exe" using Sdktoolspath "" or the registry key :"HKEY_Local_Machine\Software\Microsoft\Microsoft SDKS\Windows\v8.1A\WinSDK-NetFx40Tools-x86". Make sure the Sdktoolpath is set and the the tool exists in the correct processor specific location under the SdkToolPath and the microsoft Windows SDK is installed.

Checking the registry entries gives this : enter image description here

My dev machine has .Net Framework 4.6 Target Pack and Runtime framework. I want to publish using this framework only. How to resolve this ?


Solution

  • Installing Windows SDK 8.1 worked for me -

    https://developer.microsoft.com/en-us/windows/downloads/windows-8-1-sdk.

    Plus you need to have the .net Framework installed which is required by your project.

    https://www.microsoft.com/net/targeting?utm_source=getdotnetsdk&utm_medium=referral