Tutorial :Why is Nant not working with TeamCity?


I have nant set up to build my ASP.NET MVC project and it works fine locally. I add nant to a tools folder and add it to version control. TeamCity picks up my changes and starts the build but it fails.

I believe I'm using the latest version of Nant and I have added the .net framework 3.5 to the nant.exe.config. What am I missing on the server and yes the .net framework is installed on the server as the asp.net mvc app does work if I manually build and deploy there?

The build file is as follows:

<target name="compile" description="Compiles using the AutomatedDebug Configuration">      <msbuild project="Tolt.Sims.sln" />  </target>  

Here is the error:

  BUILD FAILED Failed to initialize the 'Microsoft .NET Framework 2.0' (net-2.0) target framework.  Property evaluation failed. Expression: ${path::combine(sdkInstallRoot, 'bin')} ^^^^^^^^^^^^^^ Property 'sdkInstallRoot' has not been set.  For more information regarding the cause of the build failure, run the build again in debug mode. Try 'nant -help' for more information  


If you're using the beta version of NAnt (which currently is the only way you'll get support for targeting anything greater than the 2.0 framework), you maybe running into a registry problem. A similar problem was reported by Tim Barcz.

Things pretty much boiled down to NAntContrib (provider of msbuild task) pointing to the 2.0 version of msbuild. Check out his solution to see if it applies to your scenario.


Potentially, you dont have the .NET Framework 2.0 SDK installed.

You can install it from http://www.microsoft.com/downloads/details.aspx?familyid=fe6f2099-b7b4-4f47-a244-c96d69c35dec&displaylang=en


I fixed this by adding the following in the registry:

New string value at: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework

Named: sdkInstallRootv2.0

With the value: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\

Seemed to spring into life...



This was fixed after the 0.86 beta1 release. On April 1, 2010, 0.90 was released with the fix in case upgrading nant is an option for you. To provide further detail, the fix release in 0.90 appears to have been simple changes to the nant.exe.config file. The bolded text below was added and will likely fix the problem without having to install the 2.0 SDK.

<directory name="${path::combine(sdkInstallRoot, 'bin')}" if="${property::exists('sdkInstallRoot')}" />

Update the net-2.0 section to fix it.


See http://www.mail-archive.com/nant-developers@lists.sourceforge.net/msg07519.html; it's a known bug in 0.86 beta1.


I've run into similar issues with NAnt. I know this isn't the Best solution, but it is one that works if you need to get your project moving.

I've found that installing a development environment (C# Express didn't work for me, but VS 2008 did) on the server makes this issue go away. (Yes, I realize this goes against normal best practices, but it works and lets my scripts run so I can get back to coding.)

Just figured I'd share incase anyone else is in a similar situation..(this has worked for me both with CruiseControl.Net and with Hudson).

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »