public Assembly LoadFromPath(string fullPath) { if (fullPath == null) { throw new ArgumentNullException(nameof(fullPath)); } Debug.Assert(Path.IsPathRooted(fullPath)); lock (_guard) { Assembly assembly; if (_pathsToAssemblies.TryGetValue(fullPath, out assembly)) { return(assembly); } var contextForAssemblyPath = new MSBuildLoadContext(fullPath); assembly = contextForAssemblyPath.LoadFromAssemblyPath(fullPath); if (assembly != null) { _pathsToAssemblies[fullPath] = assembly; } return(assembly); } }
private Assembly LoadUsingPluginContext(string fullPath) { lock (_guard) { Assembly assembly; if (_pathsToAssemblies.TryGetValue(fullPath, out assembly)) { return(assembly); } var contextForAssemblyPath = new MSBuildLoadContext(fullPath); assembly = contextForAssemblyPath.LoadFromAssemblyPath(fullPath); if (assembly != null) { _pathsToAssemblies[fullPath] = assembly; } return(assembly); } }