How do I need to indicate to the msbuild task in my nant script that it should use .net 4.0 rc?
-
why is there an msbuild task in your nant script? Is you are using msbuild, why would you do it that way around? – Mitch Wheat Mar 01 '10 at 02:33
-
1You can use NAnt to handle the overall project automation tasks (e.g. running tests, running analyses, versioning, packaging...) and delegating to MSBuild for compilation. – Grant Palin Mar 01 '10 at 19:08
-
Grant is correct, Nant is doing the build, running the test, running ncover, and then handling some database scripting. – ctrlalt313373 Mar 01 '10 at 21:55
2 Answers
I think the latest NAnt/NAntContrib defaults to .NET 3.5, so you'll have to change that to 4.0. There is a NAnt property to handle that (<property name="nant.settings.currentframework" value="net-4.0" />
), which should go near the top of your NAnt build file.
Next, you'll need to go into your NAnt's configuration file and add the 4.0 node, so that NAnt (and by extension NantContrib) are aware of the new CLR version.

- 4,546
- 3
- 36
- 55
-
This appears to have solved it. Just wanted to attached a link to a blog where I found the actual nant config section. Just had to update the version number to the release candidate and add a line to the startup section. http://paigecsharp.blogspot.com/2009/08/nant-net-framework-40-configuration.html – ctrlalt313373 Mar 02 '10 at 00:50
-
That is essentially what I had to do when trying my automated builds with VS 2010/.NET 4. Sorry I couldn't paste the solution here, but I didn't have the code handy. Glad I was able to help you towards the solution though. – Grant Palin Mar 02 '10 at 19:49
The first option is to change the executable that MSBuild
task uses. According to the doco this is a framework property so you would need to change it in the main nant config file rather than in you're individual script, and you would have to do it on every machine you plan on building the script on.
The other option is to use the exec
task instead. This question and answer should help with that.
EDIT: Forgot to mention the directories MSBuild is in. To change versions just use a different MSBuild.
2.0: %windir%\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
3.5: %windir%\Microsoft.NET\Framework\v3.5\MSBuild.exe
4.0b2: %windir%\Microsoft.NET\Framework\v4.0.21006\MSBuild.exe

- 1
- 1

- 70,676
- 20
- 104
- 133