This blog will help you setup the CI/CD with Jenkins & .NET.
Tools Used:
- Platform: .NET 4.5.2
- IDE: Visual Studio 2015 (MSBuild files)
- Application type: Windows Service
- NuGet: Package Manager used for all references.
- Source Control: Git (github.com)
Install the MSBuild Plugin for Jenkins:
Manage Jenkins -> Manage Plugins -> Msbuild -> Install it
Configure MSBuild
Manage Jenkins — Global Tool Configuration ->
Path -> C:\Windows\Microsoft.NET\Framework\v4.0.30319 ( This is by default present if .net framework is installed don your machine). Check the path and version and accordingly put in the jenkins configuration.
MSBuild is successfully configured.
Now we will create a job in Jenkins
- Open Jenkins Url -> Create a free style project
- In Source Control Management – Select Github ->https://github.com/devops4solutions/jenkins-ci-dotnet.git
Add a build Step -> Execute Windows Batch Command ->nuget restore src/MyWindowsService/
Add another build step -> Build Visual Studio project -> src/MyWindowsService/MyWindowsService/Deploy-Windows-Service-Via-MSBuild.proj
Now save the project and trigger the build.
Check the Results
Open Services -> check whether the services got created as shown in the screenshot
Congratulations, finally you have setup a CI/CD with Jenkins & .NET.