Skip to content

Instantly share code, notes, and snippets.

@jesulink2514
Created January 8, 2016 04:06
Show Gist options
  • Save jesulink2514/fc4dbf0e68eebc0af8fe to your computer and use it in GitHub Desktop.
Save jesulink2514/fc4dbf0e68eebc0af8fe to your computer and use it in GitHub Desktop.
Compilar C# con C#
//set the compiler options to use 3.5 version of assemblies
Dictionary<string,string> compilerOptions=new Dictionary<string, string>();
compilerOptions.Add("CompilerVersion", "v3.5");
// Select the code provider
CSharpCodeProvider codeProvider = new CSharpCodeProvider(compilerOptions);
CompilerParameters compilerparams = new CompilerParameters();
// we dont want to generate an executable
compilerparams.GenerateExecutable = false;
// Save the assembly as a physical file.
compilerparams.GenerateInMemory = true;
//add reference to any assemblies that are in different location
compilerparams.ReferencedAssemblies.Add("System.Core.dll");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment