user1512541
user1512541

Reputation: 51

NANT 0.92 SDK 7 not found

Environment:

Windows 2008 R2 64Bit SDK installed at C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1

Framework installed at C:\Windows\Microsoft.NET\Framework64\v4.0.30319

Trying to run Nant to compile some .NET 4 classes and we are getting the following message.

The SDK for the 'net-4.0' framework is not available or not configured.:

            NAnt.Core.BuildException: The SDK for the 'net-4.0'
framework is not available or not configured.
               at NAnt.Core.Tasks.ExternalProgramBase.DetermineFilePath()
               at NAnt.Core.Tasks.ExternalProgramBase.get_ProgramFileName()
               at
NAnt.Core.Tasks.ExternalProgramBase.PrepareProcess(Process process)
               at NAnt.Core.Tasks.ExternalProgramBase.StartProcess()
               at NAnt.Core.Tasks.ExternalProgramBase.ExecuteTask()
               at NAnt.Core.Task.Execute()
               at NAnt.Core.Target.Execute()
               at NAnt.Core.Project.Execute(String targetName, Boolean
forceDependencies)
               at NAnt.Core.Project.Execute()
               at NAnt.Core.Project.Run()

In looking at the NANt.exe.config it would appear that it looks to the registry to find the applicable path for the SDK.

<project>
 <readregistry
     property="installRoot"
      key="SOFTWARE\Microsoft\.NETFramework\InstallRoot"
      hive="LocalMachine" />
 <locatesdk property="sdkInstallRoot"
 minwinsdkver="v7.0A" minnetfxver="4.0" maxnetfxver="4.0.99999"
 failonerror="false" />
</project>

The key does not exist in the registry nor does our SDK version match the minwinsdkver="v7.0A"

Anyone run into this issue and found a valid work-around?

Upvotes: 5

Views: 2224

Answers (2)

David Bremner
David Bremner

Reputation: 406

I ran into this issue yesterday. Another workaround is to mark the NAnt executable as 32 bit.

  1. Open a Developer Command Prompt
  2. Change to the directory that contains your NAnt executable.
  3. Run the following command: corflags NAnt.exe /32Bit+

Upvotes: 0

Richard
Richard

Reputation: 187

Simplest solution is to add the key to the registry.

For myself the registry entry was slightly different: at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework set sdkInstallRootv2.0=C:\Program Files\Microsoft SDKs\Windows\v7.0A.

After this Nant compiled fine as expected.

Upvotes: 1

Related Questions