Create a Windows Jenkins server to automate build .NET project with MSBuild. Technologies used are MSBuild, nuget, and git. The main reason to setup Jenkins on Windows is explicitly to build Windows application.
**depends on the output you want to build, please choose the right operating system before you start.
- Trigger build by git push or tag.
- Build Unit Test and post result.
- Jenkins
- MSBuild
- Git for Windows
- Manage Jenkins > Manage Plugins
- Subversion 2.5.4
- Git >=2.4 Plugin (and dependencies)
- MSBuild Plugin
- Nuget Plugin
- Manage Jenkins > Configure System
- Provide svn version if any
- Provide git.exe location ie. C:\Program Files\Git\bin\git.exe
- Provide MSBuild.exe location ie. C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe
-
Create Jenkins Job
- Freestyle Project
- Choose Git > URL > Credential
- Add Build Steps
- Execute Windows Batch command > nuget restore solution.sln (if any)
- Build project with MSBuild > solution.sln with parameter /property:Configuration=Release (if any)
- Add Post-Build Steps.
- Archive the artifacts > ProjectFolder/bin/Release/.exe,ProjectFolder/bin/Release/.dll (folder/** means including subdirectories)
-
Build Now
- Manage Jenkins > Manage Plugins > Add GitLab Plugin & Gitlab Hook Plugin.
- Manage Jenkins > Configure System > Test Connection (after fill up).
- Host: https://gitlab.com
- API token get from your gitlab profile > account.
- Create a new build job as appropriate.
- Manage Project > Configure > Build Triggers > Build when change is pushed to Gitlab.
- Go to gitlab project setting > web hooks > Add web hook http://localhost:8080/project/ProjectName%20Build > Test Hook to see result.
- Done.
Ensure xunit.runner.console in nuget package.
- Install xUnit plugin.
- Add Windows batch command after build > packages\xunit.runner.console.2.1.0\tools\xunit.console.exe MyProject.Test\bin\Release\MyProject.Test.dll -xml MyProjecct.Test\bin\Release\MyProject.test-result.xml
- Add post build actions > Publish xUnit test result report > **/Release/*test-result.xml
- Enjoy.
Add Jenkins cattrige at OpenShift Web Console.
- Install RubyGem 1.9.3 on Windows
- C:> gem install rhc
- C:> rhc setup
- C:> openshift.redhat.com
- C:> [email protected]
- C:> password
- C:> rhc create-app jenkins jenkins-1 --no-git
- Done
see https://developers.openshift.com/en/getting-started-windows.html
**ignore the error message 'It appears that your reverse proxy set up is broken.'
See also