gpt4 book ai didi

.net - "reference was created to embedded interop assembly"是什么意思?

转载 作者:行者123 更新时间:2023-12-01 23:44:38 27 4
gpt4 key购买 nike

我收到以下警告:

A reference was created to embedded interop assembly c:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework\.NETFramework\v4.0\Accessibility.dll
because of an indirect reference to that assembly created by assembly c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Windows.Forms.dll. Consider changing the 'Embed Interop Types' property on either assembly.`

我的程序集包含对 Accessibility.dll 和 System.Windows.Forms.dll 的引用。为什么我会收到此警告?

顺便说一句,Accessibility.dll 的“Embed Interop Types=true”而 System.Windows.Forms.dll 将其设置为 false。

最佳答案

根据 MSDN:

“您已添加对程序集 (程序集 1) 的引用,该程序集的嵌入互操作类型属性设置为 True。这指示编译器嵌入该程序集中的互操作类型信息。但是,编译器无法嵌入该程序集中的互操作类型信息程序集,因为您引用的另一个程序集 (程序集 2) 也引用了该程序集 (程序集 1),并且“嵌入互操作类型”属性设置为 False。”

解决此警告

要嵌入两个程序集的互操作类型信息,请将所有对 assembly1 的引用的“嵌入互操作类型”属性设置为 True。

这意味着您必须在 System.Windows.Forms.dll 上更改“Embed Interop Types=true”

要删除警告,可以将 assembly1 的嵌入互操作类型属性设置为 False。在这种情况下,互操作类型信息由主互操作程序集 (PIA) 提供。

关于.net - "reference was created to embedded interop assembly"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8156488/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com