1

based on this issue I tried another way for loading assembly so I wrote a snippet code for loading assembly

  public class Program
    {
        public static void Main(string[] args)
        {
            var name = AssemblyLoadContext.GetAssemblyName(@"C:\MainParser.Contract.dll");
            var loaded = Assembly.Load(name);
        }
    }

Error Message

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in System.Private.CoreLib.ni.dll

Additional information: Could not load file or assembly 'MainParser.Contract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

enter image description here

Microsoft .NET Core Shared Framework Host

  Version  : 1.0.1
  Build    : cee57bf6c981237d80aa1631cfe83cb9ba329f12

dotnet --version
1.0.0-preview2-003131

seems name variable get info from .dll file correctly but Why in loading said FileNotFound ?

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
NBM
  • 1,231
  • 4
  • 14
  • 18
  • 3
    Does the .dll, you know.. exist? – ThePerplexedOne Sep 14 '16 at 15:38
  • @ThePerplexedOne , If you see picture name variable got info from .dll so dll exists and dit not move or rename – NBM Sep 14 '16 at 16:45
  • Does that library itself have dependencies that might not be met? I feel like in a chained load the message always says the first library but the error code is for whatever library failed. – bartonjs Sep 14 '16 at 17:06
  • @bartonjs I used standard class of microsoft this is my snippet code on console application as simple as you see, have one dependency AssemblyLoadContext needs "System.Runtime.Loader": "4.0.0" – NBM Sep 14 '16 at 17:23

0 Answers0