Skip to content

Instantly share code, notes, and snippets.

@c1982
Created June 1, 2012 21:34
Show Gist options
  • Save c1982/2855259 to your computer and use it in GitHub Desktop.
Save c1982/2855259 to your computer and use it in GitHub Desktop.
Generate Assembly
private string GenerateAssembly(string username, string password, string _assemblyPath)
{
var _result = "";
using (var csc = new CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", "v3.5" } }))
{
var parms = new CompilerParameters(new[] { "mscorlib.dll", "System.Core.dll", "FluentMigrator.dll" });
parms.GenerateExecutable = false;
parms.OutputAssembly = _assemblyPath;
CompilerResults r = csc.CompileAssemblyFromSource(parms, AssemblyString(username, password));
r.Errors.Cast<CompilerError>().ToList().ForEach(error => _result += error.ErrorText);
}
return _result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment