Programmatic Compile

Results 1 to 3 of 3

Thread: Programmatic Compile

  1. #1
    Join Date
    Dec 1969

    Default Programmatic Compile

    I&#039;m writing a C# Windows Form that should allow a <BR>developer to compile different projects (that they select <BR>from choices on the form), compare the versions of the <BR>DLLs for certain projects, or back the code up to Visual <BR>Source Safe.<BR><BR>I got the version verifcation part done and I wrote a <BR>method to handle the compilation, but the projects don&#039;t <BR>compile when I use the application to compile them. I can <BR>compile them in Visual Studio just fine. Does anyone know <BR>how to write a method to compile a given project??<BR><BR>Also, I have no idea where to begin with the backing files <BR>up to VSS. Is this even possible to do through a C# app?<BR><BR>I&#039;ve been searching Google for a few hours now trying to <BR>find an answer to this. So please do not just tell me to <BR>search on Google.<BR><BR>I found this code and I tried to use it, but I&#039;m getting <BR>an error on every compilation, "A namespace does not <BR>directly contain members such as fields or methods".<BR><BR>CSharpCodeProvider codeProvider = new CSharpCodeProvider();<BR>ICodeCompiler icc = codeProvider.CreateCompiler();<BR><BR>System.CodeD om.Compiler.CompilerParameters parameters = <BR>new CompilerParameters();<BR>parameters.GenerateExecut able = true;<BR>parameters.OutputAssembly = Output;<BR>CompilerResults results = icc.CompileAssemblyFromSource<BR>(parameters,Sourc eString);<BR><BR>if (results.Errors.Count &#062; 0) {<BR> foreach(CompilerError CompErr in results.Errors){<BR> textBox2.Text = textBox2.Text +<BR> "Line number " + CompErr.Line + <BR> ", Error Number: " + CompErr.ErrorNumber + <BR> ", &#039;" + CompErr.ErrorText + ";" + <BR> Environment.NewLine + Environment.NewLine;<BR> }<BR> }<BR><BR><BR>Thanks in advance for your help!<BR>Angela<BR>

  2. #2

    Default RE: Programmatic Compile

    I think that the SourceString parameter is actual code.<BR><BR>You could dig into the NANT stuff, i think it might be on sourceforge

  3. #3

    Default RE: Programmatic Compile...More

    Also, Hippo.Net, Draco.Net, and CruiseControl.Net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts