MSBuild and Jenkins: where to put credentials?

continuous-integration, git, jenkins, msbuild, visual-studio

Solution

I would recommend not building a .sln or .csproj file directly. But write a mini-msbuild-definition file (usually .proj) and put some parameters in there. (And keep your command line call simpler)

Then your question changes slightly to "how do I store credentials". I usually store them in a standalone file.

This url shows how to protect the "sensitive info" file.

Encrypting password in a MSBuild file

I like to store my info in a small xml file, as seen here:

FTP Credentials for MSBuild.ExtensionPack.Communication.Ftp

Here is an example of a "basic msbuild (.proj)" file. (Below link)

This is for CC.NET. But the philosophy is the same. Do very little hudson/jenkins/cc.net/other propietrary calls. Use a .proj file for 99% of what you need to do. and think of your CI (jenkins/cc.net/other) as a "super fancy msbuild executor"

How to setup building steps for CruiseControl.net from repository of the building project?

Problem

I am trying to set up a small continuous integration server using Jenkins, Git and MSBuild. I have read so many different tutorials on this topic but I still have so many questions! I created a Jenkins job which will pull changes from Git and deploy to another server with MSBuild. The build action is calling MSBuild.exe and takes the following properties: ``` /p:VisualStudioVersion=12.0 /p:Configuration=Release /p:Platform="Any CPU" /p:DeployOnBuild=True /p:DeployTarget=Test /p:MsDeployServiceUrl=https://myserver:8172/MsDeploy.axd /p:AllowUntrustedCertificate=True /p:UserName=myusername /p:Password=mypassword ``` It is working happily, but I would like to know more. For example: - I am specifying the credentials as properties. Is there a better way to go? Please note that the deployment server is external (not in LAN) - Do I need to use the `/P:CreatePackageOnPublish=True` property? If yes, why? Until now I have tried to follow the following tutorials: - http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity.html - http://www.infoq.com/articles/MSBuild-1 - http://www.jayway.com/2012/10/17/a-simple-continuous-integration-and-deployment-workflow-with-asp-net-mvc-github-and-jenkins/

Original source