Ejemplo n.º 1
0
        private ProjectCompiler RunCode_CompileCode(CompilerProjectReader compilerProject, string assemblyFilename, string sourceFile)
        {
            ProjectCompiler compiler = new ProjectCompiler(CompilerManager.Current.Win32ResourceCompiler, CompilerManager.Current.ResourceCompiler);

            //try
            //{
            compiler.SetOutputAssembly(assemblyFilename + ".dll");
            compiler.AddSource(new CompilerFile(sourceFile));

            if (compilerProject != null)
                compiler.SetProjectCompilerFile(compilerProject.GetProjectCompilerFile());

            // CompilerDefaultValues from runsource.runsource.config.xml runsource.runsource.config.local.xml
            //compiler.SetParameters(GetRunSourceConfigCompilerDefaultValues(), runCode: true);
            compiler.SetParameters(compilerProject, runCode: true);
            compiler.SetTarget("library");

            CompilerManager.Current.UpdateAssemblies(compiler.Assemblies.Values);
            compiler.Compile();

            return compiler;
        }