<p>I have CruiseControl.NET Version 1.4 set up on my development server.  Whenever a developer checks in code, it makes a compile.  </p>

<p>Now we're at a place where we can start giving our application to the testers.  We'd like to use ClickOnce to distribute the application, with the idea being that when a tester goes to test the application, they have the latest build.  </p>

<p>I can't find a way to make that happen with CruiseControl.NET.  We're using MSBUILD to perform the builds.</p>

[{'answer_id': 12497, 'author': 'Dale Ragan', 'author_id': 1117, 'author_profile': 'https://Stackoverflow.com/users/1117', 'pm_score': -1, 'selected': False, 'text': '<p>You want to use the ClickOnce manifest generation tasks in msbuild.  The process is a little long winded, so I am just going to point you to a couple of links.  Here is the <a href="http://msdn.microsoft.com/en-us/library/6wc2ccdc.aspx" rel="nofollow noreferrer">reference on msdn</a> and a <a href="http://windowsclient.net/articles/ClickOnce_MsBuild.aspx" rel="nofollow noreferrer">sample article</a> to hopefully get you started.</p>\n'}, {'answer_id': 12512, 'author': 'Judah Gabriel Himango', 'author_id': 536, 'author_profile': 'https://Stackoverflow.com/users/536', 'pm_score': 5, 'selected': False, 'text': '<p>We\'ve done this and can give you some pointers to start.</p>\n\n<p>2 things you should be aware of:</p>\n\n<ul>\n<li>MSBuild can generate the necessary deployment files for you.</li>\n<li>MSBuild won\'t deploy the files to the FTP or UNC share. You\'ll need a separate step for this.</li>\n</ul>\n\n<p>To use MSBuild to generate the ClickOnce manifests, here\'s the command you\'ll need to issue:</p>\n\n<pre><code>msbuild /target:publish /p:Configuration=Release /p:Platform=AnyCPU; "c:\\yourProject.csproj"\n</code></pre>\n\n<p>That will tell MSBuild to build your project and generate ClickOnce deployment files inside the <em>bin\\Release\\YourProject.publish</em> directory.</p>\n\n<p>All that\'s left is to copy those files to the FTP/UNC share/wherever, and you\'re all set.</p>\n\n<p>You can tell CruiseControl.NET to build using those MSBuild parameters.</p>\n\n<p>You\'ll then need a CruiseControl.NET build task to take the generated deployment files and copy them to the FTP or UNC share. We use a custom little C# console program for this, but you could just as easily use a Powershell script.</p>\n'}, {'answer_id': 103741, 'author': 'fnCzar', 'author_id': 15053, 'author_profile': 'https://Stackoverflow.com/users/15053', 'pm_score': 2, 'selected': False, 'text': '<p>I remember doing this last year for a ClickOnce project I was working on. I remember it taking me forever to figure out but here it is. What I wanted my scripts to do was to generate a different installer that pointed to our dev env and a different one for prod. Not only that but i needed it to inject the right versioning information so the existing clients would \'realize\' there is a new version out there which is the whole point of clickOnce. \nIn this script you have to replace  with your own server names etc. The trick is to save the publish.htm and project.publish file and inject the new version number based on the version that is provided to you by CC.NET.</p>\n\n<p>Here is what my build script looked like:</p>\n\n<pre><code>&lt;target name="deployProd"&gt;\n  &lt;exec program="&lt;framework_dir&gt;\\msbuild.exe" commandline="&lt;project&gt;/&lt;project&gt;.csproj /property:Configuration=PublishProd /property:ApplicationVersion=${build.label}.*;PublishUrl=\\\\&lt;prod_location&gt;\\binups$\\;InstallUrl=\\\\&lt;prod_location&gt;\\binups$\\;UpdateUrl=\\\\&lt;prod_location&gt;\\binups$\\;BootstrapperComponentsUrl=\\\\&lt;prod_location&gt;\\prereqs$\\ /target:publish"/&gt;\n\n  &lt;copy todir="&lt;project&gt;\\bin\\PublishProd\\&lt;project&gt;.publish"&gt;\n\n    &lt;fileset basedir="."&gt;\n      &lt;include name="publish.htm"/&gt;\n    &lt;/fileset&gt;\n\n    &lt;filterchain&gt;\n      &lt;replacetokens&gt;\n        &lt;token key="CURRENT_VERSION" value="${build.label}"/&gt;\n      &lt;/replacetokens&gt;\n     &lt;/filterchain&gt;\n  &lt;/copy&gt;\n\n&lt;/target&gt;\n</code></pre>\n\n<p>Hope this helps</p>\n'}, {'answer_id': 462529, 'author': 'proudgeekdad', 'author_id': 702, 'author_profile': 'https://Stackoverflow.com/users/702', 'pm_score': 5, 'selected': True, 'text': '<p>Thanks for all the help.  The final solution we implemented took a bit from every answer.</p>\n\n<p>We found it easier to handle working with multiple environments using simple batch files.  I\'m not suggesting this is the best way to do this, but for our given scenario and requirements, this worked well.  Supplement "Project" with your project name and "Environment" with your environment name (dev, test, stage, production, whatever).</p>\n\n<p>Here is the tasks area of our "ccnet.config" file.</p>\n\n<p></p>\n\n<pre><code>&lt;!-- override settings  --&gt;\n&lt;exec&gt;\n    &lt;executable&gt;F:\\Source\\Project\\Environment\\CruiseControl\\CopySettings.bat&lt;/executable&gt;\n&lt;/exec&gt;\n\n&lt;!-- compile --&gt;\n&lt;msbuild&gt;\n    &lt;executable&gt;C:\\WINDOWS\\Microsoft.NET\\Framework\\v3.5\\MSBuild.exe&lt;/executable&gt;\n    &lt;workingDirectory&gt;F:\\Source\\Project\\Environment\\&lt;/workingDirectory&gt;\n    &lt;projectFile&gt;Project.sln&lt;/projectFile&gt;\n    &lt;buildArgs&gt;/noconsolelogger /p:Configuration=Debug /v:diag&lt;/buildArgs&gt;\n    &lt;targets&gt;Rebuild&lt;/targets&gt;\n    &lt;timeout&gt;0&lt;/timeout&gt;\n    &lt;logger&gt;ThoughtWorks.CruiseControl.MsBuild.XmlLogger,ThoughtWorks.CruiseControl.MsBuild.dll&lt;/logger&gt;\n&lt;/msbuild&gt;\n\n&lt;!-- clickonce publish  --&gt;\n&lt;exec&gt;\n    &lt;executable&gt;F:\\Source\\Project\\Environment\\CruiseControl\\Publish.bat&lt;/executable&gt;\n&lt;/exec&gt;\n</code></pre>\n\n<p></p>\n\n<p>The first thing you will notice is that CopySettings.bat runs.  This copies specific settings for the environment, such as database connections.</p>\n\n<p>Next, the standard MSBUILD task runs.  Any compile errors are caught here and handled as normal.</p>\n\n<p>The last thing to execute is Publish.bat.  This actually performs a MSBUILD "rebuild" again from command line, and parameters from CruiseControl are automatically passed in and built.  Next, MSBUILD is called for the "publish" target.  The exact same parameters are given to the publish as the rebuild was issued.  This keeps the build numbers in sync.  Also, our executables are named differently (i.e. - ProjectDev and ProjectTest).  We end up with different version numbers and names, and this allows ClickOnce to do its thing.</p>\n\n<p>The last part of Publish.bat copies the actual files to their new homes.  We don\'t use the publish.htm as all our users are on the network, we just give them a shortcut to the manifest file on their desktop and they can click and always be running the correct executable with a version number that ties out in CruiseControl.</p>\n\n<p>Here is CopySettings.bat</p>\n\n<pre><code>XCOPY "F:\\Source\\Project\\Environment\\CruiseControl\\Project\\app.config" "F:\\Source\\Project\\Environment\\Project" /Y /I /R\nXCOPY "F:\\Source\\Project\\Environment\\CruiseControl\\Project\\My Project\\Settings.Designer.vb" "F:\\Source\\Project\\Environment\\Project\\My Project" /Y /I /R\nXCOPY "F:\\Source\\Project\\Environment\\CruiseControl\\Project\\My Project\\Settings.settings" "F:\\Source\\Project\\Environment\\Project\\My Project" /Y /I /R\n</code></pre>\n\n<p>And lastly, here is Publish.bat</p>\n\n<pre><code>C:\\WINDOWS\\Microsoft.NET\\Framework\\v3.5\\MSBuild.exe /target:rebuild "F:\\Source\\Project\\Environment\\Project\\Project.vbproj" /property:ApplicationRevision=%CCNetLabel% /property:AssemblyName="ProjectEnvironment" /property:PublishUrl="\\\\Server\\bin\\Project\\Environment\\\\"\nC:\\WINDOWS\\Microsoft.NET\\Framework\\v3.5\\MSBuild.exe /target:publish "F:\\Source\\Project\\Environment\\Project\\Project.vbproj" /property:ApplicationVersion="1.0.0.%CCNetLabel%" /property:AssemblyVersion="1.0.0.%CCNetLabel%" /property:AssemblyName="ProjectEnvironment" \n\nXCOPY "F:\\Source\\Project\\Environment\\Project\\bin\\Debug\\app.publish" "F:\\Binary\\Project\\Environment" /Y /I\nXCOPY "F:\\Source\\Project\\Environment\\Project\\bin\\Debug\\app.publish\\Application Files" "F:\\Binary\\Project\\Environment\\Application Files" /Y /I /S\n</code></pre>\n\n<p>Like I said, it\'s probably not done the way that CruiseControl and MSBUILD developers had intended things to work, but it does work.  If you need to get this working yesterday, it might be the solution you\'re looking for.  Good luck!</p>\n'}, {'answer_id': 714157, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>Just be able passing the ${CCNetLabel} in the CCNET.config msbuild task would be a great improvement.</p>\n'}]
['https://Stackoverflow.com/questions/12482', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/702/']