2014-04-01 60 views
0

我有一個桌面WPF應用程序,我需要隨時進行更新。我有一個更新服務,可以提供更新的DLL和一個可以將更新應用到所述WPF應用程序的客戶端。不過,我想使用MSBuild增量構建來創建一個只包含更新的DLL的修補程序。有沒有辦法建立一個完整的應用程序,並只輸出包含更新到單獨目錄的DLL?我該如何增量構建我的應用程序

+1

你有沒有考慮建在ClickOnce部署選項?這將允許您的客戶在發佈構建時自動獲取更新。 – Brendan

+1

您似乎錯誤地將增量構建從「增量構建」應用到「增量部署」。 – Nicodemeus

+0

是的,但肯定要做增量部署,我需要找出增量構建? – jaywayco

回答

0

好吧,所以我認爲我破解了它。

解決方案是利用MSBuild incremental builds來檢查是否有更改正在編譯的文件。如果已經設置了一個屬性來指示這種情況,再次使用MSBuild將構建的dll複製到增量文件夾。

所以我的項目文件都有這個底部:

...  
    <!-- 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> 
相關問題