Omar
Omar

Reputation: 40182

Import namespace of an assembly not in bin folder

Is it possible to import a namespace 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.

Upvotes: 1

Views: 468

Answers (2)

Will Marcouiller
Will Marcouiller

Reputation: 24132

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.

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1038930

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.

Upvotes: 1

Related Questions