Skip to content

Instantly share code, notes, and snippets.

@marcofranssen
Last active December 16, 2015 13:59
Show Gist options
  • Save marcofranssen/5445409 to your computer and use it in GitHub Desktop.
Save marcofranssen/5445409 to your computer and use it in GitHub Desktop.
Gists belonging to my CI with Jenkins, MSBuild, Nuget and Git part 2 blogpost http://marcofranssen.nl/ci-with-jenkins-msbuild-nuget-and-git-part-2
<!-- The Clean Target -->
<ItemGroup>
<ProjectFiles Include="**\*.csproj" />
</ItemGroup>
<Target Name="Clean">
<Message Importance="high" Text="Cleaning folders"/>
<RemoveDir Directories="$(ReportsPath)" Condition="Exists('$(ReportsPath)')" />
<MakeDir Directories = "$(ReportsPath);$(ReportsPath)\MSpec;$(ReportsPath)\Coverage" />
<!-- Clean the source code projects -->
<MSBuild Projects="@(ProjectFiles)"
ContinueOnError="false"
Targets="Clean"
Properties="Configuration=$(Configuration)" />
</Target>
<!-- The LoadNuGetPackages Target -->
<ItemGroup>
<NuGetPackageConfigs Include="$(MSBuildStartupDirectory)\**\packages.config" />
</ItemGroup>
<Target Name="LoadNuGetPackages">
<Message Importance="high" Text="Retrieving packages for %(NuGetPackageConfigs.Identity)" />
<Exec Command="&quot;$(SrcPath)\.nuget\nuget&quot; install &quot;%(NuGetPackageConfigs.Identity)&quot; -o &quot;$(SrcPath)\packages&quot;" />
</Target>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
DefaultTargets="Compile">
<PropertyGroup>
<Configuration>Debug</Configuration>
<Platform>AnyCPU</Platform>
<DefineSolutionProperties>false</DefineSolutionProperties>
<!-- General Paths -->
<RootPath>$(MSBuildProjectDirectory)</RootPath>
<SrcPath>$(RootPath)\src</SrcPath>
<ReportsPath>$(RootPath)\reports</ReportsPath>
<ToolsPath>$(RootPath)\tools</ToolsPath>
<Packages>$(SrcPath)\packages</Packages>
</PropertyGroup>
<!-- The Clean Target -->
<ItemGroup>
<ProjectFiles Include="**\*.csproj" />
</ItemGroup>
<Target Name="Clean">
<Message Importance="high" Text="Cleaning folders"/>
<RemoveDir Directories="$(ReportsPath)" Condition="Exists('$(ReportsPath)')" />
<MakeDir Directories = "$(ReportsPath);$(ReportsPath)\MSpec;$(ReportsPath)\Coverage" />
<!-- Clean the source code projects -->
<MSBuild Projects="@(ProjectFiles)"
ContinueOnError="false"
Targets="Clean"
Properties="Configuration=$(Configuration)" />
</Target>
<!-- The LoadNuGetPackages Target -->
<ItemGroup>
<NuGetPackageConfigs Include="$(MSBuildStartupDirectory)\**\packages.config" />
</ItemGroup>
<Target Name="LoadNuGetPackages">
<Message Importance="high" Text="Retrieving packages for %(NuGetPackageConfigs.Identity)" />
<Exec Command="&quot;$(SrcPath)\.nuget\nuget&quot; install &quot;%(NuGetPackageConfigs.Identity)&quot; -o &quot;$(SrcPath)\packages&quot;" />
</Target>
<!-- The Compile Target -->
<Target Name="Compile" DependsOnTargets="Clean;LoadNuGetPackages">
<Message Importance="high" Text="Compiling core projects"/>
<MSBuild Projects="$(SrcPath)\MyProject.Core\MyProject.Core.csproj"
Properties="Configuration=$(Configuration);Platform=$(Platform)" />
<MSBuild Projects="$(SrcPath)\MyProject.Web\MyProject.Web.csproj;$(SrcPath)\MyProject.Win\MyProject.Win.csproj"
Properties="Configuration=$(Configuration);Platform=$(Platform)"
BuildInParallel="true" />
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment