Today I am going share how to build .NET full Framework application using Jenkins. I am not going to show all the steps but explain you at high level how you can achieve that. I have a plan to make detail steps on how to setup Jenkins pipeline, Build environment in future.
What I need
Now to building code using any automation tool is very normal. Here I will explain how to build code using Jenkins for .NET full framework application. You need to have Jenkins installed and having admin privilege to configure the tool in Jenkins. Also MSBuild installed in your machine and path is set in Jenkins.
Following are URL to get these software,
Audience :
- You are aware of command line MSBuild.
- Some idea on Jenkins and Groovy script.
How I can run the MSbuild using Jenkins pipeline
Make sure specific .NET MS build tool is available in Jenkins for e.g. MSBuild14, MSBuild15, MSBuild16 etc. As name suggested lower build versions is having support up to specific .NET full framework.
Jenkins is able to Checkout the code from any Source Control like Git, TFS etc and that is setup already done in Jenkins before build the code.
You can use standard pipeline steps(no coding required) or groovy script to build the code
Build using Freestyle pipeline
Open your Jenkins console and select Freestyle project and create it with a name.
FreeStyle Project |
Once it is created, Under Build section, you will find the Msbuild option
Then select appropriate msbuild version for your build
List of MSbuild tools configured in Jenkins |
Using Groovy DSL (This gives you more flexibility from standard pipeline creation)
1. Make sure The MSBuild is configured in Jenkins(admin has privilege to setup this)
in the groovy code get the path of msbuild.exe. Make sure path of msbbuild.exe is same across the all windows node.
Construct the MSBuild command in your code.
Run the command using bat command. For example
Msbuild.exe /p:Configuration=DEV /p:DeployOnBuild=True /p:PublishProfile=PubProfile.pubxml.
đŸ“”Point to Remember
Note that the Msbuild switch may differ based upon type of application you are going to build like web application, Console/Windows application.
Try to use nugget package reference instade of using direct dll reference from project file.
No comments:
Post a Comment