Gemma schrieb:
> Hi Markus,
>
> Thanks for responding.
>
> The build.basedir property error was a typo!!! I couldn't copy and paste my
> code! 
>
> I've checked whether the vcproject opens in VC++ 2005 and whether I can
> build from command line and the answer to both is yes. I am aware (from
> googling prior to posting this question to you all) that <solution> does not
> work with Visual Studio 2005 projects / solutions which indicates why I
> could be getting the error (see http://www.dalun.com/blogs/01.31.2007.htm).
> I have tried the solution given and failed to get it to find msbuild. I also
> tried the nant-contrib <msbuild> with a similar outcome.
>
> Please let me know if further info is required or if there is another way of
> doing this. I am trying to build *.vcproj and *.csproj projects.
>
>   
As I said, I haven't used the <Solution /> statement in NAnt before, but 
it looks to me like it somehow tries to use MSBuild.exe on the .vcproj.

I can provide two scenarios that are working for me, however:


Option 1 would be to invoke devenv (Visual Studio itself) for compiling 
your solution:

    <echo message="Compiling Solution with Visual Studio 2005" />
    <exec
      
program="${environment::get-variable('VS80COMNTOOLS')}..\IDE\devenv.com"
      commandline="MySolution.sln /rebuild ${build.configuration}"
    />


Option 2 would be to list the projects you want compiled in a .csv file 
and manually invoke either msbuild.exe or vcbuild.exe depending on the 
project type:

    <property
      name="vcbuild.binary"
      
value="${environment::get-variable('VS80COMNTOOLS')}../../VC/VCPackages/VCBuild.exe"
    />

    <foreach
      item="Line" in="${build.platform}.projects.csv" delim=","
      property="project.directory,project.msbuildfile,project.binary"
    >

      <!--
        Until VC2008 is out, we need to compile VC++ projects using
        MSBuild.exe from the command line to prevent TeamCity from
        hijacking the MSBuild task and causing the build to fail.
      -->
      <if test="${path::get-extension(project.msbuildfile) == '.vcproj'}">
        <exec
          program="${vcbuild.binary}"
          workingdir="${project.directory}"
        >
          <arg value="/rebuild" />
          <arg value="${project.msbuildfile}" />
          <arg value="${build.configuration}" />
        </exec>
      </if>

      <!-- Normal projects are safe to compile with the MSBuild task as 
usual -->
      <if test="${path::get-extension(project.msbuildfile) != '.vcproj'}">
        <msbuild
          project="${project.directory}/${project.msbuildfile}"
          target="Rebuild"
        >
          <arg value="/p:Configuration=${build.configuration}" />
        </msbuild>
      </if>

    </foreach>


> Thanks
>
> Gemma
>
>   
Hope that helps, otherwise you'll have to wait for someone else to 
provide further insight :)

-Markus-


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to