0
我有一個解決方案結構如下:鎖定的目標組件,帶Mono.Cecil能和PCL代碼注入
**CoreSolution**
|
+---- Core.dll (PCL)
|
+---- CodeInjectionLogic (Inserts IL instruction on each type using Mono.Cecil for PCL)
**BuildSolution**
|
+---- Core.dll (For Project Reference)
|
+---- CustomMSBuildTask.dll (Injects the code into the target.dll)
|
+ ---CodeInjectionTask
Applies CodeInjectionLogic on each Type to weave IL instruction
**TargetSolution**
|
+---- Core.dll (For Project Reference)
|
+---- Target.dll (PCL)
|
+ <using Task CodeInjectionTask....>
爲CustomMSBuildTask.dll鎖定問題是通過複製在作爲BeforeBuild事件的臨時董事的所有DLL解決。
構建包含目標程序集並使用Mono.Cecil的TargetSolution我能夠讀取Target.dll修改類型並插入IL指令,但是當我嘗試使用Mono.Cecil.AssemblyDefiniyion寫回修改的流時。寫()我總是從MSBuild得到一個錯誤
該進程無法訪問Target.dll,因爲它正在被另一個進程使用。我認爲這是MSBuild本身。
關於如何使用Mono.Ceeil和PCL編譯使用自定義MSBuild AfterBuild目標構建的目標程序集的任何指針。