Reputation: 71101
I have a solution called StoreExample
It has one web project - StoreExample.Web
It has one class library StoreExample.Core
Web has a reference to Core. What is the proper way to get an assembly reference to StoreExample.Core so I can loop over the classes in StoreExample? It seems like in LoadAssembly() method call I have to know the path to the assembly. Should I have to? If so what is the standard line of code for this? If not, what is the correct way to do it?
Upvotes: 1
Views: 4222
Reputation: 1890
Here's a better answer if you are working with assemblies that are loaded at run time and whose type is not known at compile time. A good real-life example of this is loading 3rd party plugin modules.
http://msdn.microsoft.com/en-us/library/x4cw969y.aspx
Upvotes: 0
Reputation: 51478
You should be able to use System.Reflection.Assembly.GetAssembly() as shown below:
Assembly.GetAssembly(typeof(StoreExample.Core.SomeClassInCore));
Upvotes: 3