Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Problem with dynamic assembly loading #1412

Closed
justkao opened this issue Mar 15, 2015 · 4 comments
Closed

Problem with dynamic assembly loading #1412

justkao opened this issue Mar 15, 2015 · 4 comments

Comments

@justkao
Copy link

justkao commented Mar 15, 2015

I am trying to write little code generation tool as ASP .NET 5 console app

Problem:
AssemblyA
AssemblyB that depends on AssemblyA

Using IAssemblyLoadContext.LoadFile I load both assemblies into memory, but upon accessing AssemblyB.ExportedTypes the FileNotFoundException is thrown (complaining about AssemblyA not found).

ActualCode:
https://github.com/justkao/Bolt/blob/Bolt_ASPNET5/src/Bolt.Console/AssemblyCache.cs

Should I use other API to dynamically load assemblies ? The AppDomain.AssemblyResolve is not available in dnxcore profile.

@davidfowl
Copy link
Member

Dependent assemblies aren't loaded by default from the side by side location.

You can add a custom IAssemblyLoader that handles that.

@davidfowl
Copy link
Member

@davidfowl
Copy link
Member

I took a look at your code and you can totally implement that alot more efficiently by using a custom loader implementation.

@justkao
Copy link
Author

justkao commented Mar 15, 2015

Thanks for pointing me into the right direction. I basically used the code from your example and it's working fine. I will deal with performance later, currently I am just experimenting with the new runtime ... i like it quite a lot, good job ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants