Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying .NET with Jenkins/Hudson

Tags:

I've been using Jenkins/Hudson CI for deploying my .NET web site project. I've been using the MSbuild plugin to build my project, and then xcopy to copy it out to the server.

I've noticed if I use the publish feature in Visual Studio I get a different set of files. I've got the config transforms working, but I end up with all the .cs files and a winmerge compare shows the binaries being different.

So, I'd like to either get Jenkins working just like the publish feature, or confirm that an xcopy deploy is functionally the same thing.

like image 791
Dan Williams Avatar asked Apr 07 '11 13:04

Dan Williams


People also ask

Can Jenkins be used for .NET applications?

Jenkins itself is written in Java, thus for other project types, you would require consuming those extensions. I will demonstrate usage of the . NET build system in Jenkins workflow to build your . NET apps, as soon as there are changes in the repository.

How do I create a .NET code in Jenkins?

Build Actions Trigger Jenkins and start to run Jenkins Job. Connect the TFS and pull the project into a local folder which is located in CI server. Then, build the latest release with MSBuild. Start to run NUnit Unit Tests and execute code coverage with OpenCover.


2 Answers

I've had good experiences with using Web Deploy and as a final build step with Jenkins running a bat file containing:

msdeploy.exe -verb:sync -source:package=%PACKAGE% -dest:auto,ComputerName=%TARGETHOST% 

You'll have to install the web deploy package on your build server and the extention on IIS.

like image 154
Anders Lindahl Avatar answered Oct 20 '22 06:10

Anders Lindahl


I'm using the MSBuild Jenkins plugin to build and then deploy the project. As mentioned in other answers, you need to have Web Deploy installed.

In the project configuration page in Jenkins, you need to add the following to the Command Line Arguments field:

/p:Configuration=Debug /p:DeployOnBuild=true /p:PublishProfile=publishProfileName 

Of course, you need to first create the publish profile, either in VS or by exporting it from IIS and you also need to specify the solution file path in the MSBuild Build File field.

like image 41
elolos Avatar answered Oct 20 '22 07:10

elolos