Scope
I am looking to setup a continuous integration service to our process. I have previously setup Jenkins on another project, but I am after something that could cost me less time to setup. We already using Visual Studio Online for our file repository and it comes with a CI integration that I maybe able to utilize.
Steps
Create a Build
- In visual studio, go to Team Explorer
- Select Builds -> New Build Definition
- In Trigger, we will choose continuous integration
- In Source Settings, we will pick the branch that we are working on as active; We will pick folders that we do not want to include for the build as cloak, this will reduce the time for the CI server to get the files.
- After walking thru the wizard, we will save our build definition.
- We now have our first CI build for the branch.
Email Notification
- In Team Explorer, go to Settings
- Under Team Project, choose Project Alerts
- Choose Advanced Alerts Management Page
- We can choose to receive alerts if a build complete or a build fail
NuGet
In our solution, we do not check in packages to the version control as we use NuGet to get the binaries to our workspace. This caused a little problem in CI as the build server doesn't seem as smart as our workspace that it would download the packages from NuGet.
After some extensive readings, we know that NuGet.exe command tool is available in VSO. In step 3, I am adding a pre-build event that will force MSBuild to restore NuGet packages before building the solution. In step 1 and 2, I simply need to download and setup NuGet.exe command for local development environment.
After some extensive readings, we know that NuGet.exe command tool is available in VSO. In step 3, I am adding a pre-build event that will force MSBuild to restore NuGet packages before building the solution. In step 1 and 2, I simply need to download and setup NuGet.exe command for local development environment.
- Download NuGet.exe to local environment. https://nuget.codeplex.com/releases
- Add local NuGet.exe to Path in your Systerm Enivronment Variables
- Add our magic line in the pre-build event of the project.
nuget.exe restore $(SolutionPath)
- Build solution locally. We need to test and make sure the if the nuget runs correctly or not in local.
- If you get a 9009 exit code, it means the NuGet.exe path cannot be find. Restart visual studio or try run the NuGet restore in command prompt to see if the exe path is set correctly.
Test the Build
Time to test the build.
Thoughts
I am quite impressed about CI in VSO. Firstly, it is already available to me as a service and I did not have to setup a machine for it. It has a nice integration with Visual Studio and I am able to create / run builds from VS easily. The overall experience is more user friendly than Jenkins.
Ref
What are the 2 types of NuGet Package Restore?
http://docs.nuget.org/docs/reference/package-restore
Package Restore with Team Foundation
http://docs.nuget.org/docs/reference/package-restore-with-team-build
A little more hint about why a CI build might fail with NuGet packages.
http://blogs.msdn.com/b/dotnet/archive/2013/08/12/improved-package-restore.aspx
http://docs.nuget.org/docs/reference/package-restore
Package Restore with Team Foundation
http://docs.nuget.org/docs/reference/package-restore-with-team-build
A little more hint about why a CI build might fail with NuGet packages.
http://blogs.msdn.com/b/dotnet/archive/2013/08/12/improved-package-restore.aspx
This comment has been removed by a blog administrator.
ReplyDelete