public static void Main(string[] args) { var asm = args.Length > 0 ? args[0] : @"C:\Users\ben\Development\stiletto\Stiletto.Test\bin\Debug\Stiletto.Test.dll"; var ad = AssemblyDefinition.ReadAssembly(asm, new ReaderParameters { ReadSymbols = true }); var md = ad.MainModule; var weaver = new ModuleWeaver() { LogError = Console.WriteLine, ModuleDefinition = md, ReferenceCopyLocalPaths = new List<string>(), AssemblyResolver = new DefaultAssemblyResolver(), }; weaver.Execute(); ad.Write(asm, new WriterParameters() { WriteSymbols = true }); }
public ErrorReporter(ModuleWeaver weaver) { this.weaver = weaver; }
public ModuleDefinition ProcessAssembly() { logger.Debug("Reading assembly {0}...", assemblyPath); var assemblyDefinition = AssemblyDefinition.ReadAssembly(assemblyPath); logger.Debug("Assembly read. Processing..."); var moduleWeaver = new ModuleWeaver { AssemblyResolver = CreateAssemblyResolver(), Config = CreateFodyConfig(), LogError = message => Errors.Add(message), LogWarning = message => Warnings.Add(message), ProjectDirectoryPath = projectPath, ReferenceCopyLocalPaths = GetCopyLocalAssemblies(assemblyPath), ModuleDefinition = assemblyDefinition.MainModule }; try { DoInWorkingDirectory(Path.GetDirectoryName(assemblyPath), moduleWeaver.Execute); } catch (Exception ex) { logger.DebugException("Fody processing failed for assembly at " + assemblyPath, ex); WeaverException = ex; } return assemblyDefinition.MainModule; }