MS 生成错误 3181 - 引用的程序集出现问题
想象一下以下场景:
程序集“Foo.dll”引用 ADOX-Library(用于 DDL 和安全性的 Microsoft ADO Ext. 2.8),该库由 VS 2010 作为 Interop.ADOX.dll 添加到 bin 目录中。此引用的“copy”也设置为 true。
程序集“Bar.exe”同时引用 Foo.dll 和 ADOX-Library,因为 Bar.exe 需要其中的一些功能
两个程序集均已签名
当 Bar.exe 中 ADOX 引用的“本地副本”也设置为 true 时,MS构建生成警告 3181 - “两个或多个文件具有相同的目标路径” - 这是有道理的。
但是,当我将 Bar.exe 中 ADOX 引用的“本地副本”设置为 false 时,它可以正常编译,但在应用程序启动时,会出现错误,指出无法找到程序集 Interop.ADOX 并且清单程序集的定义与程序集引用不匹配。
我想我在这里错过了一些相当简单的东西,但我无法用谷歌解决我的问题。我将感谢您提供正确方向的解决方案或提示:)
干杯
基督教
imagine the following scenario:
Assembly "Foo.dll" references the ADOX-Library (Microsoft ADO Ext. 2.8 for DDL and Security) which was added as Interop.ADOX.dll in the bin-directory by VS 2010. "Local copy" of this reference was set to true, too.
Assembly "Bar.exe" references both Foo.dll and additionally the ADOX-Library because some functionality from it is needed in Bar.exe
Both assemblies are signed
When "Local copy" of the ADOX-reference in Bar.exe is set to true as well, MS Build generates the warning 3181 - "Two or more files have the same target path" - which makes sense.
However, when I set "Local copy" of the ADOX-reference in Bar.exe to false, it compiles fine but upon startup of the application, an error is raised saying that the assembly Interop.ADOX could not be found and that the manifest definition of the assembly doesn't match the assembly reference.
I suppose I'm missing something rather simple here, but I was unable to solve my problem with Google. I'd be thankful for solutions or hints into the right direction :)
Cheers
Christian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不知道为什么 EXE 项目没有创建互操作库。但踢球这个问题。不要让 EXE 项目再次引用 ADO,而是让它引用 DLL 项目创建的互操作库。
不在公共类中公开 ADO 类型将是更好的解决方案。 ADO Ext是一个实用包,你应该能够将它封装得足够好。
Not sure why the EXE project didn't create the interop library. But punt this problem. Instead of having the EXE project reference ADO again, let it reference the interop library that was created by the DLL project.
Not exposing the ADO types in a public class would be the better solution. ADO Ext is a utility bag, you should be able to encapsulate it well enough.