本文整理汇总了C#中System.CodeDom.Compiler.CompilerResults类的典型用法代码示例。如果您正苦于以下问题:C# CompilerResults类的具体用法?C# CompilerResults怎么用?C# CompilerResults使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompilerResults类属于System.CodeDom.Compiler命名空间,在下文中一共展示了CompilerResults类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayCompilerResults
// Displays information from a CompilerResults.
public static void DisplayCompilerResults(System.CodeDom.Compiler.CompilerResults cr)
{
// If errors occurred during compilation, output the compiler output and errors.
if( cr.Errors.Count > 0 )
{
for( int i=0; i<cr.Output.Count; i++ )
Console.WriteLine( cr.Output[i] );
for( int i=0; i<cr.Errors.Count; i++ )
Console.WriteLine( i.ToString() + ": " + cr.Errors[i].ToString() );
}
else
{
// Display information about the compiler's exit code and the generated assembly.
Console.WriteLine( "Compiler returned with result code: " + cr.NativeCompilerReturnValue.ToString() );
Console.WriteLine( "Generated assembly name: " + cr.CompiledAssembly.FullName );
if( cr.PathToAssembly == null )
Console.WriteLine( "The assembly has been generated in memory." );
else
Console.WriteLine( "Path to assembly: " + cr.PathToAssembly );
// Display temporary files information.
if( !cr.TempFiles.KeepFiles )
{
Console.WriteLine( "Temporary build files were deleted." );
}
else
{
Console.WriteLine( "Temporary build files were not deleted." );
// Display a list of the temporary build files
IEnumerator enu = cr.TempFiles.GetEnumerator();
for( int i=0; enu.MoveNext(); i++ )
Console.WriteLine( "TempFile " + i.ToString() + ": " + (string)enu.Current );
}
}
}