Reputation: 37436
I'm trying to configure NAnt to automate my build process - once I've got this step nailed, I'll be integrating the unit tests.
Perhaps I don't exactly know what I want, so please correct me if there is a completely different way of doing all of this...
I want two NAnt targets, one to do quick, debug builds to make sure everything works and the tests pass, and another target to do a proper compile and publish (its a web application project)
My problems are...
here is my NAnt target for the full release compile (publish):
<target name="build.deploy" description="Compile Web Site." depends="init">
<exec basedir="." program="C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild.exe" commandline=" MyProj/Interface/Interface.csproj /nologo
/t:Compile
/t:ResolveReferences;_CopyWebApplication
/p:OutDir=../../deploy/bin/
/p:WebProjectOutputDir=../../deploy/;AspNetConfiguration=Release"
workingdir="." failonerror="true" />
</target>
Thanks for you help!
P.S. I dont have to use msbuild if there is an easier way. I tried to use CSC first, but I couldnt resolve all the referencing problems i was getting. Suggestions very welcome
Upvotes: 1
Views: 3644
Reputation: 1504162
Rather than invoke MSBuild directly, I'd suggest using the NAnt-Contrib msbuild task.
For instance, in my Protocol Buffers project I have this:
<target name="build"
description="Builds all C# code">
<msbuild project="${src}/ProtocolBuffers.sln">
<property name="Configuration"
value="${build-configuration}" />
</msbuild>
</target>
When build-configuration
is Release
it doesn't build the PDBs. This depends on how you've got the project set up in Visual Studio though - you can still build PDBs for the optimised release version.
EDIT: As for the "extra junk" stuff - it will do whatever a build in Visual Studio does. If you can mess around in VS to switch various options the way you want them, it should work fine from NAnt/MSBuild too.
Upvotes: 4