Search code examples
.netnantteamcity

NAnt Builds Failing on Windows Server 2008 after installing ASP.NET 2.0 SDK


I'm using TeamCity to manage one of my projects however it doesn't seem to be working well with Nant on Windows Server 2008. What can I do to fix this?

BEFORE Installing the ASP.NET 2.0 Framework SDK:

[10:21:07]: BUILD FAILED
[10:21:07]: Failed to initialize the 'Microsoft .NET Framework 2.0' (net-2.0) target framework.
[10:21:07]:     Property evaluation failed.
[10:21:07]: Expression: ${path::combine(sdkInstallRoot, 'bin')}
[10:21:07]:                             ^^^^^^^^^^^^^^
[10:21:07]:         Property 'sdkInstallRoot' has not been set.

AFTER:

[11:48:16]: Target framework: Microsoft .NET Framework 2.0
[11:48:16]: Target(s) specified: test 
[11:48:16]:  [property] Target framework changed to "Microsoft .NET Framework 3.5".
[11:48:16]: BUILD FAILED
[11:48:16]: INTERNAL ERROR
[11:48:16]: System.NullReferenceException: Object reference not set to an instance of an object.
[11:48:16]:    at NAnt.Core.FrameworkInfo.get_Version()
[11:48:16]:    at NAnt.Core.Project.UpdateTargetFrameworkProperties()
[11:48:16]:    at NAnt.Core.Tasks.PropertyTask.ExecuteTask()
[11:48:16]:    at NAnt.Core.Task.Execute()
[11:48:16]:    at NAnt.Core.Project.InitializeProjectDocument(XmlDocument doc)
[11:48:16]:    at NAnt.Core.Project.Execute()
[11:48:16]:    at NAnt.Core.Project.Run()
[11:48:16]: Please send bug report to [email protected].
[11:48:16]: Total time: 0.1 seconds.
[11:48:16]: Process exited with code 1
[11:48:16]: Build finished

Solution

  • A couple of things that may cause this.

    1. You do not have the full .Net 2.0 SDK installed.
    2. You are missing some registry keys. If you look in the registry of say a windows xp / vista machine and search for the sdkInstallRoot you will probably find it. THen just replicate the code to your server.

    However to verify that you have the .net framework sdks installed @ least just go to the C:\windows\Microsoft.net folder and go to the version you need and search within to try and find say the csc.exe or vbc.exe programs. If you cannot find them then you do not have the SDK installed but more than likely have the runtime installed.

    Give that a go and see if that helps.