Jeffrey Palermo (.com)

Sponsors

The Lounge

Wicked Cool Jobs

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Upgrade NAnt for use with VS2008 solutions and .Net 3.5

Unfortunately, we don't have a .Net 3.5-compatible NAnt distribution yet, but it's trivial to get the latest version (.85) working with .Net 3.5 and a Visual Studio 2008 solution.  Open up you nant.exe config file, and add the following framework node just below your net-2.0 node.  Not much of a change, and it's working well for me.

 

                <framework

name="net-3.5"

family="net"

version="3.5"

description="Microsoft .NET Framework 3.5"

runtimeengine=""

sdkdirectory="${path::combine(sdkInstallRoot, 'bin')}"

frameworkdirectory="${path::combine(installRoot, 'v3.5')}"

frameworkassemblydirectory="${path::combine(installRoot, 'v2.0.50727')}"

clrversion="2.0.50727"

                    >

                    <task-assemblies>

                        <!-- include .NET specific assemblies -->

                        <include name="tasks/net/*.dll" />

                        <!-- include .NET 2.0 specific assemblies -->

                        <include name="tasks/net/2.0/**/*.dll" />

                        <!-- include Microsoft.NET specific task assembly -->

                        <include name="NAnt.MSNetTasks.dll" />

                        <!-- include Microsoft.NET specific test assembly -->

                        <include name="NAnt.MSNet.Tests.dll" />

                    </task-assemblies>

                    <project>

                        <readregistry

property="installRoot"

key="SOFTWARE\Microsoft\.NETFramework\InstallRoot"

hive="LocalMachine" />

                        <readregistry

property="sdkInstallRoot"

key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRootv2.0"

hive="LocalMachine"

failonerror="false" />

                    </project>

                    <tasks>

                        <task name="csc">

                            <attribute name="exename">csc</attribute>

                            <attribute name="supportsnowarnlist">true</attribute>

                            <attribute name="supportswarnaserrorlist">true</attribute>

                            <attribute name="supportskeycontainer">true</attribute>

                            <attribute name="supportskeyfile">true</attribute>

                            <attribute name="supportsplatform">true</attribute>

                            <attribute name="supportslangversion">true</attribute>

                        </task>

                        <task name="vbc">

                            <attribute name="exename">vbc</attribute>

                            <attribute name="supportsdocgeneration">true</attribute>

                            <attribute name="supportsnostdlib">true</attribute>

                            <attribute name="supportsnowarnlist">true</attribute>

                            <attribute name="supportskeycontainer">true</attribute>

                            <attribute name="supportskeyfile">true</attribute>

                            <attribute name="supportsplatform">true</attribute>

                            <attribute name="supportswarnaserrorlist">true</attribute>

                        </task>

                        <task name="jsc">

                            <attribute name="exename">jsc</attribute>

                            <attribute name="supportsplatform">true</attribute>

                        </task>

                        <task name="vjc">

                            <attribute name="exename">vjc</attribute>

                            <attribute name="supportsnowarnlist">true</attribute>

                            <attribute name="supportskeycontainer">true</attribute>

                            <attribute name="supportskeyfile">true</attribute>

                        </task>

                        <task name="resgen">

                            <attribute name="exename">resgen</attribute>

                            <attribute name="supportsassemblyreferences">true</attribute>

                            <attribute name="supportsexternalfilereferences">true</attribute>

                        </task>

                        <task name="al">

                            <attribute name="exename">al</attribute>

                        </task>

                        <task name="delay-sign">

                            <attribute name="exename">sn</attribute>

                        </task>

                        <task name="license">

                            <attribute name="exename">lc</attribute>

                            <attribute name="supportsassemblyreferences">true</attribute>

                        </task>

                        <task name="ilasm">

                            <attribute name="exename">ilasm</attribute>

                        </task>

                        <task name="ildasm">

                            <attribute name="exename">ildasm</attribute>

                        </task>

                    </tasks>

                </framework>

Next, change the following in your NAnt build:

<property name="nant.settings.currentframework" value="net-3.5" />

Now you are off to the races.  If you have any differing experiences, please let me know.


Posted Wed, Nov 28 2007 1:22 AM by Jeffrey Palermo

[Advertisement]

Comments

Kevin Miller wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Wed, Nov 28 2007 9:20 AM

It looks like the nightly release for NAnt (a.k.a. .86 beta 1) supports .Net 3.5.

nant.sourceforge.net/.../releasenotes.html

Bil Simser wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Thu, Nov 29 2007 4:16 PM

Great tip and good timing! I used this at my talk yesterday on source control!

Tim Barcz wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Tue, Dec 4 2007 1:29 PM

thanks for the bail out Jeff, this works great!

a Roma Tomato wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Wed, Dec 5 2007 11:54 AM

Thanks a million, Jeff!  This post was very helpful.

James Curran wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Thu, Dec 6 2007 12:36 PM

I did something similar a while back (for .net3.5 Beta 2), but to get that to work, I had to copy to SYstem.dll file from the Framework\v2.0.50727 folder to the Framework\v3.5 folder

Nicolas Jeanne wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Tue, Jan 8 2008 6:39 AM

I'm sorry but in my case it doesn't work!

i've got an error with the sdkInstallRoot, please help me!

Jeffrey Palermo wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Tue, Jan 8 2008 7:29 AM

@Nicolas,

Several folks have solved this problem by installing the .Net 2.0 SDK.

Nicolas Jeanne wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Tue, Jan 8 2008 8:30 AM

Maybe but for this project i want and i need to work with the .Net Framework 3.5

Nicolas Jeanne wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Tue, Jan 8 2008 8:32 AM

the .Net Framework is intalled on my pc

Nicolas Jeanne wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Tue, Jan 8 2008 8:40 AM

net Framework 2.0 & 3.5 are installed

Nicolas Jeanne wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Tue, Jan 8 2008 11:16 AM

when i use Nant 0.85 and i add this code, when i try Nant it says to me :

invalid element <vssget> . Unknown task or datatype!

Can somebody help me?

please

Nicolas Jeanne wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Tue, Jan 8 2008 11:20 AM

sorry I didn't add NantContrib elements in Nant, but now it says to me that : Visual Studio solution version '10.0' is not supported!

Kyle Baley - The Coding Hillbilly wrote CruiseControl, VS2008 and ASP.NET MVC
on Wed, Jan 30 2008 11:55 AM

Everyone who e-mailed me asking about the realities of working down here, I will respond on this blog

DotNetKicks.com wrote Nant
on Thu, Feb 14 2008 11:41 AM

You've been kicked (a good thing) - Trackback from DotNetKicks.com

Diego C. wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Wed, Mar 12 2008 1:49 PM

I did the change on nant.exe.config but apparently the problem lies on the "solution" task.  As soon as it reads my solution file with the "Microsoft Visual Studio Solution File, Format Version 10.00" in the first line, it throws an error: Nant.Core.BuildException: Solution of file 'pathToSolution\name.sln' is not supported.  I tried running with Nant 0.85 and .086 and I still nothing.  However, v 0.86 does include the necessary entries in the nant config file for .net 3.5 .  From the Nant 0.86 release notes:  

.NET Framework 3.5

Support for targeting .NET Framework 3.5 and Mono 3.5 Profile is now available.

Note: this does not apply to the <solution> task.

Does anybody knows a work around?

Thanks

Jesper H. wrote re: Upgrade NAnt for use with VS2008 solutions and .Net 3.5
on Fri, Mar 28 2008 12:23 AM

It looks like Nant 0.86-beta1 supports MS framework 3.5 except for the <solution> task.

nant.sourceforge.net/.../releasenotes.html

Devlicio.us