Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In this tutorial we will be creating a Visual Studio MSBuild action that will build our Fluent NHibernate source repository. This tutorial assumes you have Visual Studio the .NET 4.0 Framework installed on your server.

...

So lets create our first action by navigating to the Build Runners category as seen below. Selecting the Build Runners category will display all available build runner actions that can be executed within Continua. For this tutorial we want to build our Fluent NHibernate source code using Visual StudioMSBuild, so lets add a Visual Studio .NET MSBuild Action by double clicking Visual Studio MSBuild.

Image RemovedImage Added

Selecting an action will bring up the action dialog where you can set all the properties for your Visual Studio MSBuild action. In this tutorial we will need to point this action to the Fluent NHibernate Visual Studio Example .sln csproj file, so lets set the Project File property to $Source.Fluent_Nhibernate$/src/FluentNHibernate.slnExamples.FirstProject/Examples.FirstProject.csproj. Continua CI supports Variables, Objects & Expressions which we are using in this field to point to our repository. You can see that we are using $Source.Fluent_Nhibernate$ to point to our repository rather then providing a concrete file path. This is done so that you do not need to worry about where repositories are located as Continua CI looks after all repository management for you. So lets breakdown what is happening when we define our project file as $Source.Fluent_Nhibernate$/src/FluentNHibernate.slnExamples.FirstProject/Examples.FirstProject.csproj.

Continua allows you to specify dynamic objects and variables that are then given values when a build is executed. Dynamic objects and expressions are registered with surrounding $ symbols. In the image below you can see that specifying $Source.$ displays a dropdown that lists all the repositories that can be accessed from this configuration. At the moment we only have our Fluent NHibernate repository, however any other repositories that may have been created will also display in this list. So by setting the project file to $Source.Fluent_Nhibernate$, we are pointing Continua to our Fluent_NHibernate repository. If you called your repository a different name then this property will need to reflect the new name. ie. $Source.<repo_name>$

...

Anything that follows $Source.Fluent_Nhibernate$ refers to the file structure of the repository itself. So by specifying specifying /src/FluentNHibernate.sln we /Examples.FirstProject/Examples.FirstProject.csproj we are telling Continua to get the FluentNHibernate.sln file Examples.FirstProject.csproj file from the src/Examples.FirstProject folder of the repository. On the GitHub Fluent NHibernate page you can see the project's repository structure. In the two images below, you can see how we point to the .sln csproj file in Continua CI and how the project's file structure looks over at GitHub.

Image RemovedImage Added

Image RemovedImage Added

For this tutorial we only need to set the project file Project File, set the action to enabled, set Configuration to Release, set Output Path to $Workspace$/Output and set the Using property to whichever Visual Studio version that is installed on the server..NET Framework version that is installed on the server.

You should notice that we also used a dynamic expression when setting the output path. In this case we used the expression $Workspace$. This expression is extremely important in Continua as it references the workspace folder on the agent where all your build actions will be executed. As each build is executed it dynamically creates new temporary directories on the agent while the build is executing. These directories will always be created in the ContinuaAgent folder which you specified when you installed the agent. The reason you should always refer to your build files using $Workspace$ is that you do not know the directory name or structure at runtime. By using $Workspace$, you will always be referencing the root folder for a specific build on the agent.

You may also notice that we are specifying that this project should be built in the subfolder 'Output'. By default, every stage will copy all the files from the output folder back to the Continua server once the stage has completed. This copying of data between the agent and server is defined on the stage itself using Workspace Rules. For this tutorial however, the default workspace rule is all we need, as long as our project is built in $Workspace$/Output.

The Using property is used to tell Continua which version of Visual Studio the .NET Framework it should use when executing the Visual Studio MSBuild action. This Using property uses property collectors to point Continua to the correct application it should use when performing a task. Unless your Visual Studio .NET framework was installed in a non-standard directory, the default Property Collector should find Visual StudioMSBuild. If Continua cannot find Visual Studio MSBuild then a new property collector will need to be specified in the administration section.

Once your Visual Studio MSBuild action has been configured, click Save which will add your action to the Workflow editor, as shown below.

Image RemovedImage Added

If you were to create additional actions then these would also be added to the Workflow editor underneath your Visual Studio MSBuild action. In Continua, actions toward the top of the list are executed before actions that are towards the bottom. For now though, the Visual Studio MSBuild action is all we need to build our project so lets save our workflow by clicking Save & Complete Wizard.

Congratulations, you have created your first action workflow! Continue on to Part 5: Run your First BuildUsing Builds where we demonstrate how to run your build and access all the build information.

Continue to Part 5: Run your First Build