自动强命名 COM Interop 包装器
我在 Visual Studio 2005 中有一个 C# 项目,它引用了一些 COM 库。当我构建它时,会抛出这样的错误:
引用的程序集“AssemblyName”没有强名称。
现在,我曾经在 Visual Studio 2003 中引用 COM 程序集,它会自动对 Interop 包装器进行签名。我所要做的就是设置“包装程序集密钥文件”。
我尝试在 Visual Studio 2005 中找到类似的设置,但没有找到。所以我想知道是否有任何等效的方法可以在 Visual Studio 2005 中强命名 COM Interops 并消除上述错误。
I have a C# project in Visual Studio 2005 that is referencing a few COM libraries. When I build it errors like this are thrown:
Referenced assembly 'assemblyName' does not have a strong name.
Now, I used to reference COM assemblies in Visual Studio 2003, and it would automatically sign the Interop wrappers. All I had to do was set the setting 'Wrapper Assembly Key File'.
I tried finding a similar setting in Visual Studio 2005, but I couldn't find any. So I was wondering if there's any equivalent way of strong naming COM Interops in Visual Studio 2005 and getting rid of the above error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来它已经在“哪里得到了回答VS 2008 中的包装器程序集密钥文件设置是什么?”问题。
It looks like it was already answered in "Where is the Wrapper Assembly Key File setting in VS 2008?" question.
除了使用 Visual Studio,您还可以使用 Tlbimp.exe 和
Aximp.exe 用于生成 Interops。 Tlbimp.exe 具有签名选项。
我使用它们为应用程序中同一 COM 组件的每个不同版本生成互操作文件。 COM 组件是供应商提供的 COM 组件,用于访问质谱文件中的数据点,并且随着供应商软件新版本的发布,COM 接口会不时发生变化。然后,应用程序可以在运行时决定使用哪个 Interop,以匹配安装该应用程序的计算机上安装的版本。
我用于生成互操作的 BAT 文件 在线。
Instead of using Visual Studio you could use Tlbimp.exe and
Aximp.exe to generate the Interops. Tlbimp.exe has options for signing.
I have used them to be generate an Interop file for each different version of the same COM component in my application. The COM components are vendor supplied COM components used for accessing data points in mass spectrometry files and the COM interface change from time to time as new versions of the vendor software is released. The application can then decide at runtime which Interop to use in order to match what version is installed on the computer where the application is installed.
The BAT file I use for generating the Interops is online.