2016-02-22 17 views
3

我在我的項目中使用了postharp。當我正在嘗試構建解決方案時,我遇到了以下錯誤。 「The "PostSharp.MSBuild.PostSharp30DetectNativeFrameworkVersion" task could not be loaded from the assembly C:\ProgramData\PostSharp\3.1.49\bin.Release\PostSharp.MSBuild.v3.1.49.Release.dll. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.確認<UsingTask>聲明是正確的?

如何解決這個問題?

謝謝

+0

PostSharp可能未被正確添加到項目中。您可以嘗試重新安裝PostSharp NuGet軟件包。還要檢查* .csproj文件中的程序集引用和「導入」元素是否指向相同版本的PostSharp。 – AlexD

回答

0

我剛纔有這個確切的問題。我改變的最後一件事是添加後生成事件(.dll和.pdb到另一個目錄的副本)。

起初我沒有'連接'這兩個事件,我仍然不確定是否有連接,而是檢查PostSharp.MSBuild.v{version}.Release.dll是否存在 - 它不是我的情況。我從所有項目中刪除了PostSharp NuGet包,刪除了包目錄並重新安裝了包。之後,PostSharp.MSBuild.v{version}.Release.dll確實存在,但沒有解決問題。

我記得我已經添加了一個postbuild複製事件並刪除了我重新啓動了我的IDE。只有在完成這兩件事情之後,我才嘗試再次構建解決方案 - 哪些方法有效。

我再次添加了postbuild事件,並點擊重新生成以及工作。所以我不能完全確定問題是否可以通過重新安裝NuGet軟件包並重新啓動Visual Studio來解決,或者如果postbuild copy命令有問題。

+0

對於我來說,重新啓動我的IDE作爲重頭戲。 – cjbarth