TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pragadheesh
NA
6
0
how to programatically create a class library using C# compiler
Jan 23 2009 9:58 AM
hi,
i want to develop a window application that will get a '.cs file' as input from a text box and create a class library(.dll file) for it.
this is the method i used to programmatically compile code and generate the executable, but i want to generate a dll.
private void Compile()
{
CSharpCodeProvider codeProvider = new CSharpCodeProvider();
ICodeCompiler icc = codeProvider.CreateCompiler();
string Output = "testAssembly.exe";
System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
parameters.GenerateExecutable = true;
parameters.OutputAssembly = Output;
CompilerResults results = icc.CompileAssemblyFromSource(parameters, txtOutput.Text.ToString());
//txtOutput is the text box where i give my code
if (results.Errors.Count > 0)
{
foreach (CompilerError CompErr in results.Errors)
{
MessageBox.Show( "Line number " + CompErr.Line +
", Error Number: " + CompErr.ErrorNumber +
", '" + CompErr.ErrorText + ";" +
Environment.NewLine + Environment.NewLine);
}
}
else
{
MessageBox.Show("Success");
}
}
this is the link i referred for programmatically compiling code using C# compiler that creates exe.
http://support.microsoft.com/kb/304655
help plz,
thanx in advance.
Reply
Answers (
2
)
How do i generate unique random numbers
how to create multiple row at runtime?