0

I have a VS solution that contains a few applications and public APIs to be published along with shared libraries. I have some shallow experience in crafting msbuild file like this one.

    <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"  DefaultTargets="Build">
<PropertyGroup>
  <Configuration>Release</Configuration>
  <Platform>Any CPU</Platform>
  <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>


  <TPath>C:\Program Files (x86)\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks</TPath>
  <ETPath>C:\Program Files (x86)\MSBuild\ExtensionPack\4.0\</ETPath>

</PropertyGroup>

<ItemDefinitionGroup />
<ItemGroup>

  <SolutionFile Include="MyApplications.sln" />

</ItemGroup>


<Target Name="Build" Outputs="@(CollectedBuildOutput)">
  <MSBuild Projects="@(SolutionFile)" Targets="Rebuild" BuildInParallel="True"
         Properties="BuildingSolutionFile=true; Configuration=$(Configuration); Platform=$(Platform); TargetFrameworkVersion=$(TargetFrameworkVersion); WarningLevel=3"
         SkipNonexistentProjects="%(ProjectReference.SkipNonexistentProjects)">
  <Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput"/>

</MSBuild>

</Target>


</Project>

Then I run

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe MyProjects.msbuild /p:outdir=C:\VSProjectsRelease\MyApplications\Release\

So all assemblies will go to the same directory. So far so good. However, if I want to zip files for each application, or harvest files for Wix setup projects, troubles will emerge.

For example, in MyApplications.sln, I have 10 projects, 3 of which are applications say AppA, AppB and AppC.

I would like to run a single msbuild file which will create 3 folders of applications, and have assemblies copied to there without explicitly defining dependencies since Sln and csproj files already have the knowledge. And I would want msbuild will build each project only once. How to do this?

ZZZ
  • 2,752
  • 2
  • 25
  • 37
  • Could you elaborate what you want to achieve? I am reading mixed signals from your question -- do you want separate output folders or build selected projects in .sln or anything else? A specific example would help. – seva titov Aug 16 '14 at 15:13
  • Just rephrased the question. I want build all projects, but only application projects will have their own output folder, and each project should be compiled only once. – ZZZ Aug 17 '14 at 10:39

0 Answers0