FromAssembly() public static method

Creates a new AssemblyTarget from the target assembly.
public static FromAssembly ( Assembly assembly ) : IAssemblyTarget
assembly System.Reflection.Assembly /// The assembly to create the target for. ///
return IAssemblyTarget
Ejemplo n.º 1
0
        /// <inheritdoc/>
        public IAssemblyTarget LoadAssembly(LoadMethod loadMethod, string assemblyPath, string pdbPath = null)
        {
            IAssemblyTarget target   = null;
            var             assembly = this.loader.LoadAssembly(loadMethod, assemblyPath, pdbPath);

            if (loadMethod == LoadMethod.LoadBits)
            {
                // Assemlies loaded by bits will have the codebase set to the assembly that loaded it. Set it to the correct path here.
                var codebaseUri = new Uri(assemblyPath);
                target = AssemblyTarget.FromPath(codebaseUri, assembly.Location, assembly.FullName);
            }
            else
            {
                target = AssemblyTarget.FromAssembly(assembly);
            }

            return(target);
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public IAssemblyTarget[] GetAssemblies()
        {
            var assemblies = this.loader.GetAssemblies();

            return(assemblies.Select(x => AssemblyTarget.FromAssembly(x)).ToArray());
        }
Ejemplo n.º 3
0
 /// <inheritdoc/>
 public IList <IAssemblyTarget> LoadAssemblyWithReferences(LoadMethod loadMethod, string assemblyPath)
 {
     return(this.loader.LoadAssemblyWithReferences(loadMethod, assemblyPath).Select(x => AssemblyTarget.FromAssembly(x)).ToList());
 }