您可以通過一些非常簡單的更改啓用MSBuild BizTalk項目的增量編譯。基本上,您需要覆蓋BizTalkCommon.targets
文件中定義的兩個目標。
這些目標可以在您自己的.btproj文件中重寫,並且不需要修改BizTalk附帶的原始.targets文件。
如何
首先創建你自己的.targets文件託管您的自定義,比如BizTalkCustom.targets
:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\BizTalk\BizTalkC.targets" />
<!-- Rerun the build process (second pass) -->
<Target Name="SecondPass" Condition="$(SecondBuild)!=true and $(TempAssemblyOnly)!=true and @(XLang)!=''">
<MSBuild Projects="$(MSBuildProjectFile)" Properties="SecondBuild=true" />
</Target>
<!-- Compile XLang/s orchestration -->
<Target
Name="CompileODX"
Condition="$(SecondBuild)==true"
Inputs="@(XLang);$(MSBuildAllProjects);$(ClrTypesAssembly)"
Outputs="$(BuildDone)">
<!-- Delete previously generated C# files from XLang compilation -->
<Delete Files="@(IntermediateAssembly)" />
<Delete Files="@(CSharpOutputFromXLang)" />
<XLangTask XLangItems="@(XLang)"
ProjectReferences="@(ReferencePath)"
WarningLevel="$(WarningLevel)"
BpelCompliance="$(BpelCompliance)"
DefineConstants="$(DefineConstants)"
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
TempAssembly="$(ClrTypesAssembly)"
OutputDirectory="$(XLangOutputPath)">
</XLangTask>
</Target>
然後,在你的.btproj文件替換最後一個Import
聲明:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MyCustomExtensions)\BizTalkCustom.targets" />
它是如何工作的
BizTalk Server項目需要以某種方式在兩遍中編譯。第一遍編譯模式,地圖和管道,而第二遍編譯編排。
您會注意到,被覆蓋的目標非常類似於BizTalkCommon.targets file
中定義的原始目標。事實上,我做了兩個簡單的改動:
第一個變化涉及修改SecondPass
目標,並在Condition
屬性增加一個額外的測試。如果你的項目甚至沒有Orchestrations,這個測試是有用的,以防止發生第二遍。
不幸的是,如果您的項目包含業務流程,原始的SecondPass
目標刪除中間程序集,然後繼續編譯業務流程。但是,如果所有文件都已更新,CompileODX
目標不需要運行。因此,第二次更改涉及將Delete
任務從SecondPass
目標移動到CompiledODX
目標。
這就是它的全部。
你用BizTalk 2010試過這個嗎? – 2012-09-20 18:50:25
適用於BizTalk Server 2010.儘管如此,沒有機會嘗試使用BizTalk Server 2010 R2。 – 2012-09-20 20:47:05
試過了,確實有效。生產時間顯着下降。謝謝! – 2012-09-20 21:01:07