问题
I noticed that projects that were originally created in VS 2008 do not compile using the nantcontrib msbuild task. There is a solution that I've seen here but it seems like a bit of a hack, considering 'MSBuildBinPath' has been depricated, and I don't exactly like the idea of changing this property on every single project file that I create in VS 2008.
Short of changing build scripts to call msbuild through an exec task, is there any way to point the msbuild task at a particular version of MSBuild? Perhaps this is in the works for the next release of Nant?
回答1:
There is another option, calling MsBuild.exe directly.
Here's an example:
<property name="MSBuildPath" value="C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe"/>
<target name="build">
<exec program="${MSBuildPath}">
<arg line='"${SolutionFile}"' />
<arg line="/property:Configuration=${SolutionConfiguration}" />
<arg value="/target:Rebuild" />
<arg value="/verbosity:normal" />
<arg value="/nologo" />
</exec>
</target>
If you're calling Nant from Cruise Control .NET, you can also add this argument:
<arg line='/logger:"C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll"'/>
回答2:
Either use this hack or upgrade to nant 0.86 beta-1 or newer
来源:https://stackoverflow.com/questions/626774/running-builds-using-net-3-5-msbuild-and-nantcontrib