static void _Main() { bool dll = false; string source1 = Environment.ExpandEnvironmentVariables(@"C:\cs-script\Dev\WPF\vs\Window1.cs"); string source2 = Environment.ExpandEnvironmentVariables(@"C:\cs-script\Dev\WPF\vs\Window1.xaml"); string source3 = Environment.ExpandEnvironmentVariables(@"C:\cs-script\Dev\WPF\vs\App.xaml"); CompilerParameters options = new CompilerParameters( new string[] { @"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll", @"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll", @"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll", @"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCore.dll", @"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll" }, Path.ChangeExtension(source1, dll ? ".dll" : ".exe"), false); options.GenerateExecutable = !dll; options.CompilerOptions += "/target:winexe "; options.IncludeDebugInformation = true; CompilerResults result = new CSCompiler().CompileAssemblyFromFileBatch(options, new string[] { //source3, source2, source1 }); }
static void _Main() { bool dll = false; string source1 = Environment.ExpandEnvironmentVariables(@"C:\cs-script\Dev\WPF\vs\Window1.cs"); string source2 = Environment.ExpandEnvironmentVariables(@"C:\cs-script\Dev\WPF\vs\Window1.xaml"); string source3 = Environment.ExpandEnvironmentVariables(@"C:\cs-script\Dev\WPF\vs\App.xaml"); CompilerParameters options = new CompilerParameters( new string[] { @"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll", @"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll", @"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll", @"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCore.dll", @"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll" }, Path.ChangeExtension(source1, dll ? ".dll" : ".exe"), false); options.GenerateExecutable = !dll; options.CompilerOptions += "/target:winexe "; options.IncludeDebugInformation = true; CompilerResults result = new CSCompiler("v3.5").CompileAssemblyFromFileBatch(options, new string[] { //source3, source2, source1 }); }