-5

Can any one help me in converting the .cs file into .dll programmatically?

halfer
  • 19,824
  • 17
  • 99
  • 186
Hemant Kumar
  • 4,593
  • 9
  • 56
  • 95
  • This has been asked, sorry I cant find the original question now. – leppie Aug 06 '10 at 11:47
  • 6
    SO users are donating their free time here so things like 'ASAP' don't quite work... – Adrian Fâciu Aug 06 '10 at 11:47
  • Related: http://stackoverflow.com/questions/3188882/compile-and-run-dynamic-code-without-generating-exe – Joey Aug 06 '10 at 11:49
  • You logged here first time ever and want people to do your job, and fast! That's much more than just being lazy [which SO users quite got used to already]. At least take time to vote up the answers and select one as accepted to give credit to people that didn't get offended and helped you. – naugtur Aug 06 '10 at 11:57
  • @naugtur: He can't upvote anything until he gets 15 rep. – SLaks Aug 06 '10 at 12:24

2 Answers2

3

You're looking for the CSharpCodeProvider class.

For example:

var compiler = new CSharpCodeProvider(new Dictionary<string, string> { { "CompilerVersion", "v4.0" } });
var options = new CompilerParameters { OutputAssembly = path);
var results = compiler.CompileAssemblyFromFile(options, sourceFile);
SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
1

Take a look at the CSharpCodeProvider class.

Joey
  • 344,408
  • 85
  • 689
  • 683