How do i Call MSBuild.exe with nant to build a solution file for visual studio 2005

Posted on 2006-05-19
Last Modified: 2012-05-05
I am using nant to do our automated builds and having a problem getting it to work with MSbuild and visual studio 2005 solutions. I am getting an error that says the return code was 1 when i tried this command below in my nant build file
<exec program="c:\windows\\framework\v2.0.50727\MSBuild.exe" commandline="/t:rebuild ${root}Web\mysite.solution.sln" />
does anybody have any ideas?
Question by:jasondole
    LVL 27

    Accepted Solution

    VS.Net doesnt store solution files in the root they are always in C:\Documents and Settings\"UserName"\My Documents\Visual Studio 2005\Projects
    this post answers your question

    LVL 19

    Expert Comment

    by:Melih SARICA
    try to use the full path of ur solution file intead of root parameter
    LVL 1

    Author Comment

    My program is still crapping out when i try to build, it says
    MSBUILD: error MSB1009: Project file does not exist
    switch: D:\devbuilds\Web\mysite.solution.sln
    external program failed: c:\windows\\framework\v2.0.50727\MSBuild.exe (return code was 1)

    Here is the command line i had based off the article you gave me:
    <exec program="c:\windows\\framework\v2.0.50727\MSBuild.exe" verbose="true" failonerror="false" commandline="/t:rebuild d:\devbuilds\Web\mysite.solution.sln" />

    Any ideas why this is?
    Thanks again for all your help!
    LVL 1

    Author Comment

    Ok, i used aspnet_compiler.exe and it seems to work with as a compiler but now i am getting errors dealing with missing assemblies, would using aspnet_compiler.exe cause these issues?
    here is my call to the aspnet_compiler.exe call i have in nant.
    <exec program="c:\windows\\framework\v2.0.50727\aspnet_compiler.exe"  commandline="-v /HBR -p d:\devbuilds\mysite\webapp -c errorstack" verbose="true" failonerror="false" workingdir="d:\devbuilds\mysite\"

    my working directory is different becuase that is the directory where my refenernces are as the target directory is the main project, please let me know if you have any suggestions or comments, thanks for your help!
    LVL 27

    Expert Comment

    the compiler needs the project to have all assemblies.
    check your classes for imports or using statements

    LVL 1

    Author Comment

    all my classes have the correct assemblies, i migrated the solution file from vs2003 to vs2005 and it worked fine when i used to compile it in vs2003 but once i switched over to vs2005, i got this error so i think i am missing something in my compile statement but i am unsure, that is just a thought...

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    This video discusses moving either the default database or any database to a new volume.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now