1
votes

I have a C# web application that I have developed using Visual Studio 2010 and commit changes to a VisualSVN repository using the AnkhSVN plugin for Visual Studio.

I have created a Jenkins project that checks the repository every five minutes for new commits and then builds the web application, using the MSBuild plugin, if it sees a change.

This is working fine, however it is building the application to C:\Program Files (x86)\Jenkins\workspace\[Jenkins Project Name]\[Web Application Name] and I would like it to build to D:\Web\[Web Application Name] as this is the directory my IIS site is pointing at. (Both locations are on the same server)

Is there a setting in the Jenkins project where I can change this or do I have to add a build step that copies to a different location using a batch command or something similar?

Many thanks in advance.

1

1 Answers

1
votes

You can specify a custom workspace for the Jenkins job to run in.

In your jenkins job look for a button on the right hand side that is labeled Advanced. On Jenkins 2.46.1 it is at the bottom of the General section just before the SCM section of the build job. Click on it and a new set of options will appear, one of them will be Use custom workspace. Check the box and put in the path to the folder you want to use. You should ensure the Jenkins user has permissions on this folder or bad things might happen.

Note that this will perform the entire build in this folder, so anything else that is also in the workspace folder for that build job will be in the new location.

If you want just the output files without all the source and other stuff you will indeed have to add another build step (batch is one option) to copy the relevant files from your build jobs workspace (which can be accessed in batch using the WORKSPACE variable jenkins defines for the job) to the desired destination folder.