本文整理汇总了C#中IAssemblyLoadContext.LoadFile方法的典型用法代码示例。如果您正苦于以下问题:C# IAssemblyLoadContext.LoadFile方法的具体用法?C# IAssemblyLoadContext.LoadFile怎么用?C# IAssemblyLoadContext.LoadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAssemblyLoadContext
的用法示例。
在下文中一共展示了IAssemblyLoadContext.LoadFile方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public Assembly Load(string name, IAssemblyLoadContext loadContext)
{
PackageAssembly assemblyInfo;
if (_dependencyResolver.PackageAssemblyLookup.TryGetValue(name, out assemblyInfo))
{
return loadContext.LoadFile(assemblyInfo.Path);
}
return null;
}
示例2: Load
public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
{
// TODO: preserve name and culture info (we don't need to look at any other information)
PackageAssembly assemblyInfo;
if (_dependencyResolver.PackageAssemblyLookup.TryGetValue(new AssemblyName(assemblyName.Name), out assemblyInfo))
{
return loadContext.LoadFile(assemblyInfo.Path);
}
return null;
}
示例3: Load
public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
{
// TODO: preserve name and culture info (we don't need to look at any other information)
string path;
if (_assemblies.TryGetValue(new AssemblyName(assemblyName.Name), out path))
{
return loadContext.LoadFile(path);
}
return null;
}
示例4: Load
public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
{
if (_response.Diagnostics.HasErrors())
{
throw new DesignTimeCompilationException(_response.Diagnostics);
}
if (_response.AssemblyPath != null)
{
return loadContext.LoadFile(_response.AssemblyPath);
}
if (_response.PdbBytes == null)
{
return loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes), assemblySymbols: null);
}
return loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes),
new MemoryStream(_response.PdbBytes));
}
示例5: Load
public Assembly Load(IAssemblyLoadContext loadContext)
{
if(_response.Errors.Any())
{
throw new CompilationException(_response.Errors);
}
if (_response.AssemblyPath != null)
{
return loadContext.LoadFile(_response.AssemblyPath);
}
if (_response.PdbBytes == null)
{
return loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes), assemblySymbols: null);
}
return loadContext.LoadStream(new MemoryStream(_response.AssemblyBytes),
new MemoryStream(_response.PdbBytes));
}
示例6: Load
public Assembly Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
{
string path;
var newAssemblyName = new AssemblyName(assemblyName.Name);
#if DNXCORE50
newAssemblyName.CultureName = assemblyName.CultureName;
#elif DNX451
// Assigning empty CultureInfo makes the new assembly culture as neutral which won't match the entries in _assemblies dictionary. Hence this check.
if (assemblyName.CultureInfo != null && !ResourcesHelper.IsResourceNeutralCulture(assemblyName))
{
newAssemblyName.CultureInfo = assemblyName.CultureInfo;
}
#else
#error Unhandled framework error
#endif
if (_assemblies.TryGetValue(newAssemblyName, out path))
{
return loadContext.LoadFile(path);
}
return null;
}
示例7: Load
private Assembly Load(string name, IAssemblyLoadContext loadContext)
{
string assemblyLocation;
if (_assemblyLookupTable.TryGetValue(name, out assemblyLocation))
{
using (Log.LogTimedMethod())
{
Log.LogVerbose($"Requested load of {name}");
return loadContext.LoadFile(assemblyLocation);
}
}
return null;
}
示例8: Load
public Assembly Load(IAssemblyLoadContext loadContext)
{
string outputDir = Path.Combine(Path.GetTempPath(), "dynamic-assemblies");
var result = Emit(outputDir, emitPdb: true, emitDocFile: false);
if (!result.Success)
{
throw new CompilationException(result.Errors.ToList());
}
var assemblyPath = Path.Combine(outputDir, _project.Name + ".dll");
return loadContext.LoadFile(assemblyPath);
}
示例9: Load
public Assembly Load(IAssemblyLoadContext loadContext)
{
return loadContext.LoadFile(_assemblyPath);
}
示例10:
Assembly IMetadataProjectReference.Load(AssemblyName assemblyName, IAssemblyLoadContext loadContext)
{
Console.WriteLine("*** PostSharpProjectReference.Load {0}.dll", _underlyingReference.Name);
string referencePath = Path.Combine(_workingDirectory, assemblyName.Name + ".dll");
if ( File.Exists( referencePath ))
{
return loadContext.LoadFile(referencePath);
}
return _underlyingReference.Load(assemblyName, loadContext);
}