Pre-Requisite
- Install Visual Studio .Net 4.0
- Install Sql Server management studio 2008 R2.
- Install Tortoise SVN.
- Download and install Jenkins Windows native package from http://jenkins-ci.org/.
http://msbuildextensionpack.codeplex.com/releases/view/85522
Setting up Jenkins for Source Code
Add plugin to jenkins
- Open the URL http://localhost:8080/ in browser.
- Click on Manage Jenkins.
- Navigate to "Manage Plugin" section.
- Click on available tab.
- Install Msbuild plugin(Click on install without restart)
- Restart Jenkins
Creating a new project in jenkins
- Follow all the steps mentioned in "Add plugin to jenkins".
- Click on New job
- Choose "Build a free-style software project" option. Add job name and click on "OK". It creates a new project to be built.
Configuration of the project
- Click on the newly created project.
- Click on configure
- Under "Source Code Management" choose Subversion module option.
- Fill the 'Repository URL' textbox with the corresponding sourcecode URL of SVN.
Note- it may ask for credentials. Please fill the credentials for SVN(which you use to log in to SVN) so that jenkins application can access SVN. Refer the below image.
5. Click on 'Add build Step' button and choose 'Build a visual studio project or solution using MsBuild' option.
6. Fill the details as shown in the below image.
Note- MsBuild file should be the build script file from local directory.
7. Click on save.
8. Build the project
9. Build details can be seen on the console output section on the left hand navigation panel.
Scriptfile code-
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProductVersion>10.0.11107</ProductVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<Target Name="PrecompileWeb">
<AspNetCompiler
VirtualPath="/TestWebSite"
PhysicalPath="C:\Test-CI\SourceCode\TestWebSite"
TargetPath="c:\precompiledweb\TestWebSite\"
Force="true"
Debug="true" />
</Target>
</Project>
<PropertyGroup>
<ProductVersion>10.0.11107</ProductVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<Target Name="PrecompileWeb">
<AspNetCompiler
VirtualPath="/TestWebSite"
PhysicalPath="C:\Test-CI\SourceCode\TestWebSite"
TargetPath="c:\precompiledweb\TestWebSite\"
Force="true"
Debug="true" />
</Target>
</Project>