CruiseControl.Net Build Publisher - Only publish compiled files
-
09-06-2019 - |
Question
While setting up CruiseControl, I added a buildpublisher block to the publisher tasks:
<buildpublisher>
<sourceDir>C:\MyBuild\</sourceDir>
<publishDir>C:\MyBuildPublished\</publishDir>
<alwaysPublish>false</alwaysPublish>
</buildpublisher>
This works, but it copies the entire file contents of the build, I only want to copy the DLL's and .aspx pages, I don't need the source code to get published.
Does anyone know of a way to filter this, or do I need to setup a task to run a RoboCopy script instead?
Solution
I set up a task to do this. I'm not aware of any way to make CruiseControl be that specific. I usually just chain a batch file to do the copy to the CC.net task.
OTHER TIPS
I'm not sure with a web project, but for our winforms app, you can grab the TargetOutputs from the MSBuild task like so:
<MSBuild Projects="@(VSProjects)"
Properties="Configuration=$(Configuration)">
<Output TaskParameter="TargetOutputs" ItemName="BuildTargetOutputs"/>
</MSBuild>
and then do a copy:
<Copy SourceFiles="@(BuildTargetOutputs)"
DestinationFolder="bin"
SkipUnchangedFiles="true" />
Not sure what the TargetOutputs are for a web project, but for winforms and class libraries, it's the .dll or .exe.
The default build publisher in CC.NET does not provide a way to do this. You have a few options:
- Create your own build publisher with the desired functionality
- Create a custom NAnt/MSBuild task
- Use a scripting technology (RoboCopy, batch file, etc.) to create a script file and run an "Executable" task for CC.NET, or an "exec" task for NAnt/MSBuild
A CC.Net Powershell task can be used for this as well.