当前位置: 首页>>代码示例>>C#>>正文


C# IAssemblyLoadContext.LoadFile方法代码示例

本文整理汇总了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;
        }
开发者ID:elanwu123,项目名称:dnx,代码行数:10,代码来源:NuGetAssemblyLoader.cs

示例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;
        }
开发者ID:henghu-bai,项目名称:dnx,代码行数:11,代码来源:NuGetAssemblyLoader.cs

示例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;
        }
开发者ID:cemoses,项目名称:aspnet,代码行数:11,代码来源:PackageAssemblyLoader.cs

示例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));
        }
开发者ID:adwardliu,项目名称:dnx,代码行数:20,代码来源:DesignTimeProjectReference.cs

示例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));
        }
开发者ID:nagyistoce,项目名称:dnx,代码行数:20,代码来源:DesignTimeProjectReference.cs

示例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;
        }
开发者ID:rajeevkb,项目名称:dnx,代码行数:23,代码来源:PackageAssemblyLoader.cs

示例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;
        }
开发者ID:elanwu123,项目名称:dnx,代码行数:14,代码来源:PackageAssemblyLoader.cs

示例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);
        }
开发者ID:AtwooTM,项目名称:vNextLanguageSupport,代码行数:15,代码来源:FSharpProjectReference.cs

示例9: Load

 public Assembly Load(IAssemblyLoadContext loadContext)
 {
     return loadContext.LoadFile(_assemblyPath);
 }
开发者ID:henghu-bai,项目名称:dnx,代码行数:4,代码来源:CompiledProjectMetadataReference.cs

示例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);
        }
开发者ID:postsharp,项目名称:PostSharp.Dnx,代码行数:12,代码来源:PostSharpProjectCompiler.cs


注:本文中的IAssemblyLoadContext.LoadFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。