static void _Main() { bool dll = false; string source = Environment.ExpandEnvironmentVariables(@"%CSSCRIPT_DIR%\Samples\hello.cpp"); 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:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll", @"C:\WINDOWS\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll" }, Path.ChangeExtension(source, dll ? ".dll" : ".exe"), false); options.GenerateExecutable = !dll; //options.CompilerOptions += "/target:winexe "; options.IncludeDebugInformation = true; CompilerResults result = new CPPCompiler().CompileAssemblyFromFileBatch(options, new string[] { source }); }
static void Main(string[] args) { string[] files = new[] { @"E:\cs-script\Samples\hello.cpp" }; var cParams = new CompilerParameters(); cParams.OutputAssembly = @"C:\Users\osh\AppData\Local\Temp\CSSCRIPT\Cache\-727015236\hello.cpp.dll"; cParams.ReferencedAssemblies.Add(@"C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll"); cParams.ReferencedAssemblies.Add(@"C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Linq\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Linq.dll"); cParams.ReferencedAssemblies.Add(@"C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll"); var compiler = new CPPCompiler(); compiler.CompileAssemblyFromFileBatch(cParams, files); var parser = new CCSharpParser(@"E:\cs-script\engine\CSSCodeProvider.v3.5\Script.cs"); parser.ToTempFile(false); }