Skip to main content

MSBuild Integration

The Microsoft Build Engine (MSBuild) is the build platform for Microsoft and Visual Studio. This page explains how to integrate Agile.net into the MSBuild process.

Prerequisites

  1. Using the Agile.NET UI tool, create a project file (e.g. Protect.cls).
  2. Important: Add assemblies to the project file from the \obj\Release folder, not from \bin\Release.

Editing your project file

Open your project file (.csproj or .vbproj) with an XML editor (or Notepad). Before editing, the project file typically looks like this (simplified):

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
...
</PropertyGroup>

<Reference>
...
</Reference>

<ItemGroup>
...
</ItemGroup>

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Adding Agile.NET to the MSBuild pipeline

Add the following lines after the <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> block:

<!-- START AgileDotNet START -->
<PropertyGroup>
<AgileDotNetLocation>"C:\Program Files (x86)\SecureTeam\AgileDotNet.Console.exe"</AgileDotNetLocation>
<AgileDotNetProjectFile>"$(ProjectDir)\Protect.cls"</AgileDotNetProjectFile>
</PropertyGroup>

<Target Name="AfterCompile" Condition=" '$(Configuration)' == 'Release' ">
<Exec Command="$(AgileDotNetLocation) /project:$(AgileDotNetProjectFile)" />
</Target>
<!-- END AgileDotNet END -->

Properties

  • AgileDotNetLocation
    Path to the AgileDotNet.Console.exe file.

  • AgileDotNetProjectFile
    Path to the Agile.NET project created in the first step (the .cls project file).

With this configuration, every Release build will automatically run Agile.NET after compilation, using the project file you created in the UI.