dnx icon indicating copy to clipboard operation
dnx copied to clipboard

How to download nuget package and load its assembly in runtime?

Open causer opened this issue 11 years ago • 3 comments

I'm developing a CMF system, using asp.net 5. I think what i should implement plugin system using nuget packages, because of dnx principle "NuGet all the things".

  1. How i can search, download, unpack package in runtime?
  2. And how i can load dll from package in runtime?

(Similar question on stackoverflow: http://stackoverflow.com/questions/30989788/load-nuget-package-and-its-assembly-in-runtime)

causer avatar Jun 23 '15 14:06 causer

How i can search, download, unpack package in runtime?

Using NuGet APIs, this has nothing to do with the runtime per se. Run dnu restore.

And how i can load dll from package in runtime?

Here's an example on how to add a custom assembly loader https://github.com/aspnet/Entropy/blob/dev/samples/Runtime.CustomLoader/Program.cs

davidfowl avatar Jun 23 '15 17:06 davidfowl

Thank you for answer.

causer avatar Jun 26 '15 07:06 causer

Hello, Nowadays, is there any API to load a NuGet Package Reference (already in ./dnx/packages), or just with custom assembly loader like answered above? Maybe something new in Microsoft.Dnx.Runtime.Nuget or Microsoft.Dnx.Runtime.Loader?

And, how about automatically load dependencies (these are another Packages) of a NuGet Package?Using custom assembly loader to load direct from dll file will not load dependencies. (In these scenario, analyzing at debug, e.g. _graph field of LibraryManager does not contains my dynamic loaded assemblies. Should have it? Maybe something I made wrong...)

Thanks

rsbavaresco avatar Oct 15 '15 19:10 rsbavaresco