Import namespace of an assembly not in bin folder
Is it possible to import a namespac开发者_运维知识库e from an assembly that is not in the bin folder?
I'm using ASP.NET MVC 2 with MEF to pull controllers out of the assembly.I was able to get everything working, however, strongly typed views can't recognize the assemblies' objects unless the assembly is in the bin folder.
Strongly typed view means knowing the object type at compile time. In order to know the object at compile time the assembly containing the class needs to be referenced. Referencing assemblies in an ASP.NET application is done by putting them in the bin
folder.
If you use reflection to load assemblies from some other non-standard location, types will be known only at runtime and you cannot use them as models for strongly typed views.
If you want to load assemblies from somewhere else than the bin folder at runtime, you may do so by calling the appropriate method through the AppDomain.
精彩评论