With the release of Nant 0.86 Beta 1, .NET 3.5 and Silverlight 2.0 are supported. However, I had to make a few minor adjustments in order for Nant to work on our build servers. After running a known-good build script, on the build server, we started receiving the following error:
Internal Error: System.NullReferenceException
Object reference not set to an instance of an object.
at NAnt.Core.FrameworkInfo.get_Version()
at NAnt.Core.Project.UpdateTargetFrameworkProperties()
at NAnt.Core.Tasks.PropertyTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Project.InitializeProjectDocument(XmlDocument doc)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()
I did a quick search and found some information about this on Jeffery Palermo's site. A few people were experiencing the same problem, but the only solution they had was to use an older configuration section from this blog post. I was not satisfied with this solution so I kept investigating.
As far as I can tell, this has something to do with machines that do not actually have Visual Studio installed on them. If you manually install the .NET 3.5 SDK you may actually install a different version than the one that comes with Visual Studio 2008.
If you receive this error, look in your Nant.exe.config file and scroll down to the framework node that has an name attribute of net-3.5. Inside of this framework node, you will see a project node with the following data:
1: <readregistry
2: property="installRoot"
3: key="SOFTWARE\Microsoft\.NETFramework\InstallRoot"
4: hive="LocalMachine" />
5: <readregistry
6: property="sdkInstallRoot"
7: key="SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A\WinSDKNetFxTools\InstallationFolder"
8: hive="LocalMachine"
9: failonerror="false" />
The main thing here is to verify that these registry keys actually exist. Open up regedit and navigate to the keys indicated by the config file, if they do not match, you should correct them in the Nant.exe.config file.
I had to modify the second key to the following on our build server:
SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.1\WinSDKNetFxTools\InstallationFolder
It's easy to fix once you figure it out, Enjoy!