.Net 所需的程序集参考
我在一个 C# 项目中使用了 ReSharper 的“优化引用”功能,它删除了一对对 Fluent Nhibernate / Nhibernate 的引用。我认为这是完全有效的,因为我没有在该项目中直接引用他们的任何内容。
当我重建解决方案时,我受到了欢迎:
类型“FluentNHibernate.Mapping.ClassMap`1”是在未引用的程序集中定义的。
该项目(我们将其称为A)并不直接引用Fluent Nhibernate,而是引用了另一个项目B,该项目使用Fluent NHibernate 进行映射。至于 A 中 B 的使用,我确实使用了一个包含 FNH Map 的类,但我不会在任何地方使用/引用该内部类A。
我认为如果 .Net 项目没有直接在代码中引用程序集,那么它就不需要出现在项目引用中。或者在这种情况下这个假设是错误的?
I used ReSharper's "Optimize References" functionality on one of my C# projects, and it removed a pair of references to Fluent Nhibernate / Nhibernate. I thought this was completely valid because I don't reference anything from them directly in that project.
When I rebuild the solution I was greeted with:
The type 'FluentNHibernate.Mapping.ClassMap`1' is defined in an assembly that is not referenced.
The project (which we will call A) doesn't directly reference Fluent Nhibernate, but does reference another project B, which uses Fluent NHibernate for mappings. As far as the usage of B in A, I do use a class that has a FNH Map within it, but I don't use/reference that inner class anywhere in A.
I thought if a .Net project didn't reference an assembly in code directly, it didn't need to be in the project references. Or was this assumption wrong in this case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定您为什么会收到此特定错误,但我在 FNH / NH 支持 DLL(特别是 Castle DLLS 和 Log4Net)中看到了类似的问题。
许多工具会告诉您不需要这些引用,但如果您尝试消除它们,则会出现运行时错误。
I'm not sure why you get this particular error, but I've seen similar problems with FNH / NH support DLLs, notably the Castle DLLS, and Log4Net.
Many tools will tell you these references are not required, but you get runtime errors if you try to eliminate them.