JM (Jason Meridth)

JM (Jason Meridth)

Learn, Converse, Share

18 Feb 2008

NAnt and .NET 3.5

I recently started a personal .NET 3.5 project (finally learning the ASP.NET MVC architecture) and noticed when I tried to migrate an old NAnt build file over and run the automated build it died.  The main reason was because when I call out to msbuild to build my solution it uses the nant.exe.config file to call the msbuild.exe file in the current designated framework path (i.e., C:WINDOWSMicrosoft.NETFrameworkv2.0.50727msbuild.exe).  Well, that won’t help because .NET 3.5 solutions can’t be compiled by the .NET 2.0 msbuild.exe.

NAnt 0.86 Beta1 supports .NET 3.5.  So for those of you, using NAnt for your automated builds, and compiling .NET 3.5 solutions, hope this information helps.  If you’re concerned that it’s a beta, then read the following from their site:

“This release focuses on extending our already strong support for multiple target frameworks, bringing improved flexibility and performance.”

I know you can use csc and compile the solution that way, but it doesn’t read as nicely as a msbuild target call. :)

Does anyone have any other workarounds?

Comments

Kevin Miller: Jason, For my .Net 2.0 and 3.5 projects I usually invoke msbuild via the task. I started doing it like this before Nant had a msbuild target and just sorta stuck to it. It gives you pretty fine control over what happens and you don’t get hung up when NAnt is not up-to-date. …

Jason Meridth: @Kevin Thank you sir. After reading some of the blogs on CodeBetter and going further today I realized that it wasn’t as easy as having 0.86 Beta. I’ll try out your idea tomorrow. Thanks.

Shane Kenney: Thanks for the heads up. I was wondering where this was set! Cheers