Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top