1

I am attempting to merge a Visual Studio 2010 project to 2012. The 2010 solution had a deployment project which output can be replicated by publishing in 2012. Our build script looking something like this:

<target name="buildSolution">
    <delete file="${BuildRootFolder}\build.log" />
    <exec program="devenv.exe" verbose="true" timeout="2400000"
        commandline='/out build.log ${BuildRootFolder}\Solution.sln /Build "Release" /deploy Solution'
        basedir="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE">
        <environment>
            <variable name="PATH"
            value="blah blah....">
        </environment>
    </exec>    
</target>

How do I update this to Publish one of the projects in that solution using the publishing profile I defined?

Shawn
  • 2,356
  • 6
  • 48
  • 82

1 Answers1

2
Forget devenv and use msbuild.

<property name="MSBuildPath" value="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"/>
    <target name="buildSolution" depends="clean">
        <exec program="${MSBuildPath}">
            <arg line='"${BuildRootFolder}\Solution.sln"' />
            <arg line='/property:Configuration="Release";DeployOnBuild=true;PublishProfile=Deployment' />
            <arg value="/target:Build" />
            <arg value="/verbosity:normal" />
            <arg value="/nologo" />
        </exec>
    </target>
Shawn
  • 2,356
  • 6
  • 48
  • 82
  • When you say forget devenv does it mean its no longer work with 2012 or it just not better than MSBuild – Mubashar Oct 10 '13 at 01:09
  • One benefit i can think of is that we don't have to install visual studio on build server if we use MSBuild.exe – Mubashar Oct 10 '13 at 01:17
  • 1
    @MubasharAhmad I could not figure out how to get it to work with devenv, but I could with msbuild. I'm not using a build server so having Visual Studio wasn't an issue for me, but it is another advantage. – Shawn Oct 10 '13 at 12:39