Question

I have a desktop WPF app that i need to update every now and then. I have an update service that can deliver the updated DLLs and a client that can apply the update to the said WPF app. However i would like to make use of MSBuilds incremental builds to create a patch that contains only the updated DLLs. Is there a way to build an entire app and output only the DLLs that contain updates to a seperate directory?

Was it helpful?

Solution

Ok so i think i cracked it.

The solution was to make use of MSBuild incremental builds to check if there had been changes to the files being compiled. If there had set a property indicating such and using MSBuild again to copy out the built dll to an incremental folder.

So my project files all have this in the bottom:

...    
    <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
           Other similar extension points exist, see Microsoft.Common.targets.-->    
    <Target Name="BeforeBuild" Inputs="@(Compile)" Outputs="$(OutputPath)$(AssemblyName).dll">
      <CreateProperty Value="true">
        <Output TaskParameter="Value" PropertyName="NewFile" />
      </CreateProperty>
    </Target>
    <Target Name="AfterBuild" Condition=" '$(NewFile)' == 'true' ">
      <MakeDir Directories="$(IncrementalBuildRoot)$(BuildNumber)" Condition="!Exists('$(IncrementalBuildRoot)$(BuildNumber)')" />
      <Copy SourceFiles="$(OutputPath)$(AssemblyName).dll" DestinationFolder="$(IncrementalBuildRoot)$(BuildNumber)" />
    </Target>
 </Project>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top