當我用MSBuild構建一個簡單的C#項目時,它構建了一個不能用RegAsm註冊的程序集(錯誤RA000)。MSBuild構建的程序集無法註冊,RegAsm(錯誤RA000);完全相同.csProj與Visual Studio 2010創建有效的程序集?
使用Visual Studio 2010構建的完全相同的.csProj會成功創建有效的彙編和RegAsm寄存器?
我使用C:\windows\microsoft.net\framework64\v4.0.30319\msbuild.exe
兩個構建(的MSBuild 4.0和Visual Studio 2010)正在做的管理員權限,那麼註冊權限已啓用。
- 我正在尋求一種方法來解決/理解/調試 - 這令人沮喪的 異常。
- 可能是MSBuild 4.0我缺少一個修復/ SPx?
- 是否有工具來創建一個像文件(或其他.dll格式化程序)的地圖,所以我可以比較兩個 生成的程序集的差異? MSBuild中
輸出RegAsm內置bTest.dll
:從Visual Studio 2010內置bTest.dll
RegAsm輸出
Microsoft (R) .NET Framework Assembly Registration Utility 4.0.30319.1
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.
RegAsm : error RA0000 : Failed to load 'C:\test\bTest.dll' because it is not a valid .NET assembly
:
Microsoft (R) .NET Framework Assembly Registration Utility 4.0.30319.1
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.
Types registered successfully
Assembly exported to 'C:\test\bTest.tlb', and the type library was registered successfully
對於該bTest.csProj文件之上有Register COM interop
未選中,RegAsm作爲後期製作步驟完成。
如果建立與Register COM interop
檢查都做了,從而使能; Visual Studio 2010會正確生成bTest.tlb。但是,MSBuild確實而不是會生成bTest.tlb文件,並且生成的程序集仍然會因RegAsm 4.0工具失敗。
預先感謝您。
凱文·韋特
您使用了哪個版本的regasm?如果您針對x86程序集使用Framework64版本,則會收到一條錯誤消息,指出「RegAsm:error RA0000:無法加載'YourLib.dll',因爲它不是有效的.NET程序集」。使用x86版本,它會工作。 – timB33