Dependencies of dinamically loaded .dll are not found [Answered]

Hi everyone, I've an ASP.NET Core 6 web app where I have a main project "A" that, if certain conditions are meet, load dinamically an assembly B.dll. Now, let's say B depends upon some nuget package C (has a static reference to it). When, after B assembly has been loaded dinamically and during its code execution a class belonging to C is encountered, the program crashes since C is not found. I've noticed that, if I add to project A a static reference to C, everything works fine. Is there a way to fix this behavior without me having to add to project A static references to ALL dependencies of ALL the assemblies I want to load dinamically? Thanks
Actually I was able to fix .dll dependencies using this article https://www.codeproject.com/Articles/1194332/Resolving-Assemblies-in-NET-Core?msg=5895057#xx5895057xx I still miss how to do the same for nuget dependencies
Resolving Assemblies in .NET Core
How to resolve assemblies in .NET Core
Download the nuget, extract it, load the dll. You wont necessarily know from the assembly being loaded what nuget package its in Blindly installing nugets is rather dangerous
Ok, thanks
MMMayor McCheese8/25/2022
You might want to look a custom assembly load contexts as well https://docs.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support
UUUnknown User8/26/2022
2 Messages Not Public
Sign In & Join Server To View
✅ This post has been marked as answered!

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
Is there a way to make int [] and byte [] point to the same memory area? [Answered]1exception subclass for try-catch block [Answered]I want to subclass Exceptions to create a class that can be inserted into a catch() parameter to detLicense Key SystemHey, how would you implement a licensing system? I basically need those 3 things: - Online key valiProject PathHow can I get the Uri path to my project? What I get: `D:\csharp\MyFirstProject\MyFirstProjectUI\bi.NET 7 Rate Limit by IP address instead of PathPretty self explanatory title. ```cs app.UseRateLimiter(new RateLimiterOptions { OnRejeHow to access to the 'Index' Action without write it after slashHello dear friends, I'm working on `Asp.Net Core 6` project with `Areas`, I have a problem with `rouBest resources for learning SQL Server [Answered]I remember finding some really good sites with great documentation and tutorials explaining SQL ServOutlook InteroptUnhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'office, VersiSystem.EntryPointNotFound when trying to get C++ methodC# code: ```cs using System; using System.Collections.Generic; using System.Linq; using System.RuntiHow to structure unit tests [Answered]This is more of a preference question than anything but how do you usually structure tests? I'm... nHow to Add 4 System.Drawing.Images into a Grid? [Answered]How to build a 2x2 Grid out of 4 Images?mgcb editor doesn't running [Answered]nothing openning when i trying to open .mgcb fileHow do I add the Data folder to the Build?I want the Data Folder that is in the Solution to be accessible via File.ReadAllLines("Data\deutsch.monogame project templates doesn't have iconim installed extension for monogame template projects, and i don't have icons, it's just cosmetic prAuto placingHello Would anyone know a direction of info/documentation for auto placing clips with hitboxes? in Parsing websites using C [Answered]Are there any nuget libraries like NPM cheerio to parse websites according to their CSS selectors?WPF Handling crashes more gracefully. [Answered]I'm currently using this setup which correctly logs and displays feedback correctly, however after t❔ Should a beginner at webdev learn React or Angular for the frontend to go with ASP.NET?I know that React is a little more popular than Angular overall, but i'm not sure what it's like forHow can I sort a list of entries (Id, ParentId) into a tree hierarchy? [Answered]I have an unsorted list of entries with two notable fields: `Id` and `ParentId`. I would like to sorNeed Help with creating a JsonSchemaI need to create a JSON-Schema to validate some properties of a json object. I'm using the `oneOf` p