Why is Nant not working with TeamCity?
Asked Answered
H

6

7

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
Hairsplitter answered 27/10, 2008 at 18:56 Comment(0)
L
4

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.

Labialized answered 27/10, 2008 at 20:44 Comment(2)
Does this mean that I have to install the SDK on my build server?Ananna
I'm not entirely sure of what you're asking, but if your build server is where this nant process is executing, then you would need to install the .NET 3.5 SDK there.Labialized
P
4

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

Potiche answered 11/3, 2009 at 10:30 Comment(1)
This is the problem I had too. Not having the .Net 2.0 SDK installed causes the sdkInstallRoot property to not be set.Kb
R
3

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...

w://

Romney answered 16/4, 2009 at 9:20 Comment(1)
Thanks, that did it for me (but it should be HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework).Edlin
A
3

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.

Aaron answered 30/6, 2010 at 21:45 Comment(0)
M
1

See http://www.mail-archive.com/[email protected]/msg07519.html; it's a known bug in 0.86 beta1.

Montfort answered 8/1, 2009 at 10:35 Comment(0)
G
0

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).

Galarza answered 10/1, 2010 at 17:21 Comment(1)
I've come back to this in a new CI environment. Even with later version of the SDK installed, I was still getting this error until I installed the 2.0 SDK explicitly.Galarza

© 2022 - 2024 — McMap. All rights reserved.