I use the following "helper tasks" to allow my solutions to be built 
with NAnt, MSBuild or DevEnv (for installers).  If you look at the 
"BuildWithSolutionTask", you'll see that I use the "AssemblyFolders" 
construct, which can have as many "include" or "exclude" nodes as you need.

Tony

<readregistry property="DevEnvPath" hive="LocalMachine"
   key="SOFTWARE\Microsoft\VisualStudio\8.0\InstallDir" />                      
<!-- =================================
        target: Build Solution
================================= -->
<target name="BuildSolution">
        <property name="OutputDirectory"
          value="${OutputRoot}\${BuildConfig}\${SolutionName}"
          overwrite="true" verbose="${VerboseOutput}" />
        <call target="CleanWorkingDirectory" cascade="true"
          verbose="${VerboseOutput}" />
        <if test="${string::to-lower(BuildEngine)=='msbuild'}"
          verbose="${VerboseOutput}">
                <call target="BuildWithMsBuild" cascade="true"
                  verbose="${VerboseOutput}" />
        </if>
        <if test="${string::to-lower(BuildEngine)=='nant'}"
        verbose="${VerboseOutput}">
                <call target="BuildWithSolutionTask" cascade="true"
                  verbose="${VerboseOutput}" />
        </if>
        <if test="${string::to-lower(BuildEngine)=='devenv'}"
          verbose="${VerboseOutput}">
                <call target="BuildWithDevEnv" cascade="true"
                  verbose="${VerboseOutput}" />
        </if>
        <call target="CopyOutput" cascade="true"
          verbose="${VerboseOutput}" />
</target>       

<!-- =================================
        target: Build with NAnt Solution Task
        THIS SHOULD BE THE FIRST-CHOICE TASK FOR BUILDING SOLUTIONS,
        BUT IT WON'T ALWAYS WORK WITH ASP.NET PROJECTS IF THEY HAVE
        REFERENCES TO GAC ASSEMBLIES.  IN THAT CASE, USE THE MSBUILD
        TASK BELOW
================================= -->
<target name="BuildWithSolutionTask">
        <solution configuration="${BuildConfig}"
          includevsfolders="true" outputdir="${OutputDirectory}"
          solutionfile="${SolutionFile}" failonerror="true"
          verbose="${VerboseOutput}">
                <assemblyfolders>
                        <include
                          name="${ReferenceRoot}\${BuildConfig}" />
                </assemblyfolders>
        </solution>
</target>       

<!-- =================================
        target: Build with MSBuild Task
        THIS TASK SHOULD ONLY BE USED TO BUILD SOLUTIONS
        WITH ASP.NET WEBSITES
        THAT CAN'T BE BUILT USING THE ABOVE SOLUTION TASK
================================= -->
<target name="BuildWithMsBuild">
        <!-- MSBuild Reference:
          http://msdn2.microsoft.com/en-us/library/bb629394.aspx -->
        <msbuild project="${SolutionFile}" target="Rebuild"
          verbose="${VerboseOutput}">
                <property name="Configuration" value="${BuildConfig}"
                  verbose="${VerboseOutput}" />
                <property name="OutputDir" value="${OutputDirectory}"
                  verbose="${VerboseOutput}" />
                <property name="BuildProjectReferences" value="true" />
                <property name="OverwriteReadOnlyFiles" value="true" />
                <arg 
value="/p:&quot;ReferencePath=${FrameworkRoot};${ReferenceRoot}\${BuildConfig}&quot;"
 
/>
                <arg value="/verbosity:normal"
                  if="${string::to-lower(VerboseOutput)=='true'}" />
                <arg value="/nologo"/>
        </msbuild>
</target>               

<!-- =================================
        target: Build with DevEnv Task
        THIS TASK SHOULD ONLY BE USED TO BUILD MSI INSTALLER PROJECTS
        SINCE THOSE ARE NOT COMPATIBLE WITH THE SOLUTION TASK OR MSBUILD
================================= -->
<target name="BuildWithDevEnv">
        <!-- DevEnv Reference:
          http://msdn2.microsoft.com/en-us/library/xee0c8y7(VS.80).aspx -->
        <exec program="devenv.com" basedir="${DevEnvPath}"
          failonerror="true" verbose="${VerboseOutput}" >
                <arg value="&quot;${SolutionFile}&quot;" />
                <arg line="/build ${BuildConfig}" />
                <arg value="/project &quot;${ProjectFile}&quot;" />
                <arg line="/projectconfig ${BuildConfig}" />
                <arg value="/out 
&quot;${OutputDirectory}\DevEnv.Output.txt&quot;" />
        </exec>
</target>       

Scott Mitchell wrote:
> Ok thanks for you help. I did this through MSBuild commandline and get 
> the same errors, so yes you are correct. It is not a NANT problem. So 
> now I have another question, How do you solve this through NANT then. I 
> found a property that I can set called “AdditionalReferencePath” is that 
> what I want to use? If so how does that work if I need to add quite a 
> few paths. If that is not correct, then wht is it that I use to make 
> MSBuild see these references? I know this is a list for NANT and not 
> MSBuild, but I have been looking at all the documents for all this and 
> it is pretty overwhelming for some of it. And once I get this fixed it 
> will be for NANT’s use then J.
> 
>  
> 
> Thanks for any help,
> 
> Scott Mitchell
> 
>  
> 
> -----Original Message-----
> 
>  
> 
>  
> 
> Agreed. Make sure the hint paths are correct. Remember, the reference
> 
> paths in visual studio don't apply to msbuild run outside of it.
> 
>  
> 
> -----Original Message-----
> 
> From: [EMAIL PROTECTED]
> 
> [EMAIL PROTECTED] On Behalf Of Lattimer,
> 
> Ryan
> 
> Sent: Tuesday, April 29, 2008 2:26 PM
> 
> To: nant-users@lists.sourceforge.net
> 
> Subject: Re: [NAnt-users] MS Visual Studio 2005 Solution filesand
> 
> <msbuild>command
> 
>  
> 
> I'm not sure setting the configuration to Release is going to fix your
> 
> errors though.  My guess is you are probably getting "reference not
> 
> found errors".  You will probably have to add extra references to your
> 
> projects that Visual Studio does need because it can locate them itself.
> 
>  
> 
> -----Original Message-----
> 
> From: [EMAIL PROTECTED]
> 
> [EMAIL PROTECTED] On Behalf Of Jacob
> 
> Siegel
> 
> Sent: Tuesday, April 29, 2008 2:21 PM
> 
> To: nant-users@lists.sourceforge.net
> 
> Subject: Re: [NAnt-users] MS Visual Studio 2005 Solution files and
> 
> <msbuild>command
> 
>  
> 
> I'm fairly new myself, but the following works for me:
> 
>  
> 
> <property name="config" value="debug" overwrite="false" /> ...
> 
> <msbuild project="src/Scripting/lua/Lua.NET.sln" verbosity="Minimal">
> 
>        <property name="Configuration" value="${config}" /> </msbuild>
> 
>  
> 
>  
> 
>      -Jacob
> 
>  
> 
> Quoting Scott Mitchell <[EMAIL PROTECTED]>:
> 
>  
> 
>> I hope someone here can help me.
> 
>> 
> 
>> 
> 
>> 
> 
>> I am new to NANT. So please forgive me if I am overlooking something.
> 
>> 
> 
>> 
> 
>> 
> 
>> My problems is using VS 2005 solution files and NANT. I understand 
> 
>> from the documentation that 2005 Solution files can not be used when 
> 
>> using the NANT <solution> command. So it was suggested on one of the 
> 
>> posts in archives for this list that <msbuild> be used. But I have 
> 
>> problems with that also.
> 
>> 
> 
>> 
> 
>> 
> 
>> Here is the lines from my .build file that should build the solution 
> 
>> file. It launches the solution file, and does the build but I get all 
> 
>> kinds of errors when building through this, whereas if I launch the 
> 
>> .sln file myself and do the build that way it works fine with now 
> 
>> errors. One of the things that I noticed is that I need to set the 
> 
>> buildtype = release. How would I do that with this command? I can't 
> 
>> seem to find any examples on using <msbuild> command.
> 
>> 
> 
>> 
> 
>> 
> 
>> <target name="buildBuilder">
> 
>> 
> 
>> <msbuild
> 
>> project="${local.chekout.path}\lightnet\lights32\lights32.sln"/>
> 
>> 
> 
>> </target>
> 
>> 
> 
>> 
> 
>> 
> 
>> This should be a lot easier than I am making it out to be, and I am 
> 
>> sure I am just missing something, but I can't seem to figure it out.
> 
>> 
> 
>> 
> 
>> 
> 
>> Any sort of help would just be greatly appreciated.
> 
>> 
> 
>> 
> 
>> 
> 
>> Thanks,
> 
>> 
> 
>> Scott Mitchell
> 
>> 
> 
>> 
> 
>> 
> 
>> --
> 
>> 
> 
>> Scott Mitchell
> 
>> 
> 
>> Engineering
> 
>> 
> 
>> 
> 
>> 
> 
>> Colorado vNet
> 
>> 
> 
>> 
> 
>> 
> 
>> direct 970 203 3756
> 
>> 
> 
>> main 970 203 3700
> 
>> 
> 
>> fax 970 203 3701
> 
>> 
> 
>> 
> 
>> 
> 
>> email [EMAIL PROTECTED]
> 
>> <[EMAIL PROTECTED]>
> 
>> 
> 
>> web www.coloradovnet.com <http://www.coloradovnet.com>
> 
>> 
> 
>> 
> 
>> 
> 
>> 255 East Sixth Street
> 
>> 
> 
>> Loveland, Colorado 80537
> 
>> 
> 
>> 
> 
>> 
> 
>> 
> 
>> 
> 
>> 
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> NAnt-users mailing list
> NAnt-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nant-users

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to