These days it is very common to have a continuous build process that includes: compilation, code analysis and automated tests. The way of implementing this kind of process varies depending on the technology of the project.
I have worked with Ruby, Python, Java, JavaScript, Smalltalk and some other languages and in all cases you just need to install 3 tools:
- the runtime/sdk (like ruby, jdk, cog)
- a package manager (like bundle, maven, pip, metacello)
- a build tool (like rake, maven, fabric)
Any other thing you may need (linter, testing framework, etc), you can get it using the package manager and make it run as part of your build script.
But in .Net the situation is more complex. First of all everything seems to be very tight to Visual Studio (the IDE). Because of this, many people just install the Visual Studio in the build server.
Additionally to this the .Net SDK does not provide a test framework. You can use NUnit (which you will have to install manually) or you can use MSTest but to use it you need to install Visual Studio.
FxCop (the linter) comes with Visual Studio but if you don’t want Visual Studio, then you have to install it manually.
So, in order to avoid several manual tasks when setting up a new dev box and also to minimize any possible difference between dev boxes and the build server box I did the following:
- I downloaded all the tools I wanted to use in my build process and placed them into the same directory (c:\BuildTools).
- I wrote a build script (using MSBuild and defining my own targets). This script «glues» the invocation to all of these tools: NuGet, FxCop, StyleCop and NUnit.
- Finally I package all these stuff in a self-extracting .zip file so all the team members can easily replicate my setup.
In order to have the build process to run continuously I also installed this package in the Jenkins build server.
2 comentarios en “Integrating .Net Build tools: MSBuild, NuGet, FxCop, StyleCop and NUnit”