我正在使用新的MSBuild內聯任務來利用Microsoft.Web.Publishing.Tasks.dll
程序集中的TransformXml(XDT變換)。MSBuild內聯任務 - 參考非標準Microsoft程序集
這裏就是我的任務(剪斷)看起來像:,
<Task>
<Reference Include="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>
<Reference Include="System.Xml" />
<Using Namespace="System"/>
<Using Namespace="System.Linq"/>
<Using Namespace="System.IO" />
<Using Namespace="System.Xml"/>
<Using Namespace="Microsoft.Web.Publishing.Tasks"/>
<Code Type="Fragment" Language="cs">...</Code>
</Task>
編譯沒有和DLL加載,但在執行時,因爲它試圖找到它是應用平臺的路徑裝配失敗:C:\Windows\Microsoft.NET\Framework\v4.0.30319
。我會期待它看到我給它的道路。
融合日誌顯示此:
=== Pre-bind state information ===\r
LOG: User = xxx\Kamran\r
LOG: DisplayName = Microsoft.Web.Publishing.Tasks, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)\r
LOG: Appbase = file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/\r
LOG: Initial PrivatePath = NULL\r
Calling assembly : (Unknown).\r
===\r
LOG: This bind starts in default load context.\r
LOG: Using application configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe.Config\r
error MSB4018: LOG: Using host configuration file: \r
error MSB4018: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.\r
error MSB4018: LOG: Post-policy reference: Microsoft.Web.Publishing.Tasks, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\r
error MSB4018: LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Web.Publishing.Tasks.DLL.\r
error MSB4018: LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Web.Publishing.Tasks/Microsoft.Web.Publishing.Tasks.DLL.\r
error MSB4018: LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Web.Publishing.Tasks.EXE.\r
error MSB4018: LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Microsoft.Web.Publishing.Tasks/Microsoft.Web.Publishing.Tasks.EXE.\r
有什麼辦法解決這一問題或將我不得不創建任務組件呢?
不正確關閉的錯誤報告:[MSBuild:用於內聯任務引用的路徑未被遵守](https://connect.microsoft.com/VisualStudio/feedback/details/768289/msbuild-path-used-for-直列任務引用是 - 不兌現)。重新提交:[MSBuild:用於內聯任務引用的路徑不受尊重(採取2)](https://connect.microsoft.com/VisualStudio/feedback/details/2285231) – Stijn 2016-01-26 11:04:16
該錯誤已被Microsoft轉載,您可以在https://github.com/Microsoft/msbuild/issues/594上關注其進展 – Stijn 2016-04-28 08:14:12