Tony
Tony

Reputation: 3409

Jenkins deployment for .net application

I am new to Jenkins and have a question about deployment through Jenkins.

I have .net application that has been added to Jenkins, it builds successfully, but now I am wondering what would be best practice for deploying .net application in general. Especially, when I have to change the configuration file (ex. Web.config) to reflect an environment (or other settings)before I deploy (ex. Test or Production), what is a best way to accomplish the deployment process through Jenkins if you have to change configuration files before the deployment?

For example, If I want to deploy to a test and production environments, and connectionStr needs to be updated accordingly? What is a best to do this?

Thanks for your help.

Upvotes: 2

Views: 3744

Answers (2)

DarrellNorton
DarrellNorton

Reputation: 4651

You will probably deploy using Web Deploy http://www.iis.net/downloads/microsoft/web-deploy

If using Web Deploy, you can use either web.config transformations or Web Deploy publish profiles. Both of these are supported by Jenkins.

Web.config transformations: http://msdn.microsoft.com/en-us/library/dd465326.aspx

Web Deploy Publish Profiles: http://msdn.microsoft.com/en-us/library/dd465323(v=vs.110).aspx (NOTE each profile has a separate web.config file named web.NAME_OF_PROFILE.config (e.g., web.debug.config))

Here is an easy walkthrough of the entire process of creating a profile: http://www.asp.net/web-forms/overview/older-versions-getting-started/deployment-to-a-hosting-provider/deployment-to-a-hosting-provider-web-config-file-transformations-3-of-12

See this question for how to make Web Deploy work with Jenkins: Jenkins, MSBuild and Web Deploy: Unable to create Web Package

Upvotes: 4

David Peden
David Peden

Reputation: 18434

What you're talking about are deploy-time transforms of configuration files. You'll definitely want to take a look at Octopus Deploy. It is hands-down the best deployment tool I've used for .NET.

You can find the documentation for config transforms here.

I'm not personally familiar with Jenkins but you should be able to wire up an automated deployment initiated by Jenkins by leveraging Octopus' command line tool octo.exe. You can see the docs for how to use it here.

Upvotes: 0

Related Questions