Execute() public method

public Execute ( ) : void
return void
コード例 #1
0
        public static Assembly WeaveAssembly()
        {
            var projectPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\AssemblyToProcess\AssemblyToProcess.csproj"));
            var assemblyPath = Path.Combine(Path.GetDirectoryName(projectPath), @"bin\Debug\AssemblyToProcess.dll");
#if (!DEBUG)
        assemblyPath = assemblyPath.Replace("Debug", "Release");
#endif

            var newAssembly = assemblyPath.Replace(".dll", "2.dll");
            File.Copy(assemblyPath, newAssembly, true);

            var moduleDefinition = ModuleDefinition.ReadModule(newAssembly);
            var weavingTask = new ModuleWeaver
            {
                ModuleDefinition = moduleDefinition
            };

            weavingTask.Execute();
            moduleDefinition.Write(newAssembly);

            return Assembly.LoadFile(newAssembly);
        }
コード例 #2
0
        public static Assembly WeaveAssembly()
        {
            var projectPath  = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\AssemblyToProcess\AssemblyToProcess.csproj"));
            var assemblyPath = Path.Combine(Path.GetDirectoryName(projectPath), @"bin\Debug\AssemblyToProcess.dll");

#if (!DEBUG)
            assemblyPath = assemblyPath.Replace("Debug", "Release");
#endif

            var newAssembly = assemblyPath.Replace(".dll", "2.dll");
            File.Copy(assemblyPath, newAssembly, true);

            var moduleDefinition = ModuleDefinition.ReadModule(newAssembly);
            var weavingTask      = new ModuleWeaver
            {
                ModuleDefinition = moduleDefinition
            };

            weavingTask.Execute();
            moduleDefinition.Write(newAssembly);

            return(Assembly.LoadFile(newAssembly));
        }