.net 缺少嵌入互操作类型属性

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4090282/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 14:52:32  来源:igfitidea点击:

missing Embed Interop Type property

.netvisual-studiocominteropwarnings

提问by Sarah Vessels

In one C# project, I get the following warning:

在一个 C# 项目中,我收到以下警告:

warning CS1762: A reference was created to embedded interop assembly 'Interop.SomeLibrary.dll' because of an indirect reference to that assembly created by assembly 'ALibraryOfMine.dll'. Consider changing the 'Embed Interop Types' property on either assembly.

警告 CS1762:创建了对嵌入式互操作程序集“Interop.SomeLibrary.dll”的引用,因为对程序集“ALibraryOfMine.dll”创建的程序集进行了间接引用。考虑更改任一程序集上的“嵌入互操作类型”属性。

However, in the C# project that gives this warning, I do not see an Embed Interop Types property on the COM library reference Properties. That's in VS 2010. In the VS 2008 ALibraryOfMine project, the same COM library also does not have an Embed Interop Types property. How can I get rid of this warning? I've been getting an "The located assembly's manifest definition does not match the assembly reference" error and I'm worried maybe differing versions of a COM library is behind it, so I wanted to eliminate COM-related errors.

但是,在发出此警告的 C# 项目中,我在 COM 库引用属性上没有看到 Embed Interop Types 属性。那是在 VS 2010 中。在 VS 2008 ALibraryOfMine 项目中,同一个 COM 库也没有 Embed Interop Types 属性。我怎样才能摆脱这个警告?我一直收到“定位的程序集的清单定义与程序集引用不匹配”错误,我担心它背后可能是不同版本的 COM 库,所以我想消除与 COM 相关的错误。

回答by Traci

You need to go to the Dll in the References, Right Click and Properites. It is there, not on the properties of your project

您需要转到参考、右键单击和属性中的 Dll。它就在那里,而不是在您项目的属性上

回答by HuseyinUslu

I had a similar warning once - i think this can help you; http://msdn.microsoft.com/en-us/library/ff183282.aspx.

我曾经有过类似的警告-我认为这可以帮助您;http://msdn.microsoft.com/en-us/library/ff183282.aspx