Dim parameters As New CompilerParameters()
Dim results As CompilerResults
parameters.GenerateExecutable = True
parameters.OutputAssembly = Output
results = icc.CompileAssemblyFromSource(parameters, SourceText)
The code above uses the CompilerParameters object to tell the compiler that you want to generate an executable file (as opposed to a DLL) and that you want to output the resulting assembly to disk. The call to CompileAssemblyFromSource is where your assembly gets compiled. This method takes your parameters object and the source code, which is a string. Once you compile your code you can check to see if there were any compilation errors. We use the return value from CompileAssemblyFromSource, which is a CompilerResults object. This object contains an errors collection, which contains any errors that occurred during the compile.
There are other options for compiling, such as compiling from a file. You can also batch compile, which means you can compile multiple files or sources at the same time. Additional information on these classes is available on MSDN Online:
159 views
Usually answered in minutes!
×