Reputation: 2240
I'm implementing a resource manager. Its interface and implementation are located in Infrastructure assembly. Resources are located in Presentation assembly. Presentation assembly references Infrastructure assembly.
My problem:
ResourceManager rm = new ResourceManager("Strings", typeof(Presentation.SomeType).Assembly);
This code in Infrastructure assembly won't compile, because SomeType is in Presentation assembly and it can't be referenced due to circular dependencies.
What is an optimal way to get Assembly type in this scenario? I can use DI container and move impl to Presentation but I don't want to do this just yet.
PS. I need to write code targeting both WinStore/WinPhone.
Upvotes: 1
Views: 101
Reputation: 2240
Looks like you can use:
var assemblyName = new AssemblyName() {Name = "YouAssemblyNameWithoutExtension"};
var assembly = Assembly.Load(assemblyName);
I've been told loading assemblies like this may pose a problem during certification, so ymmv.
Upvotes: 1