jennas
jennas

Reputation: 2464

How to run or execute two MSBuilds

I want to create one MSBuild that will execute two others..

How can i import the two others and run each of their targets in order?

UPDATE:

I was able to get this working with the following.

<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
    <Target Name="BuildAll">
        <Exec Command="C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe MSBuildSettings.xml" />
        <Exec Command="C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe PostBuild.xml" />
    </Target>
</Project>

Upvotes: 0

Views: 96

Answers (3)

Filburt
Filburt

Reputation: 18082

Normally this would be done using the MSBuild task and dependencies:

<?xml version="1.0" encoding="utf-8" ?>
<Project DefaultTargets="PostBuild">
    <Target Name="MainBuild">
        <MSBuild Projects="MSBuildSettings.xml" />
    </Target>

    <Target Name="PostBuild" DependsOnTargets="MainBuild">
        <MSBuild Projects="PostBuild.xml" />
    </Target>
</Project>

Upvotes: 1

shuniar
shuniar

Reputation: 2622

why not just write a batch file that executes two msbuild commands?

Upvotes: 1

user596075
user596075

Reputation:

Process.Start("yourFirstExecutable.exe");
Process.Start("yourSecondExecutable.exe");

Is that what you are looking for?? Process.Start() runs an external executable.

Upvotes: 0

Related Questions