CompilerResults 클래스

정의

컴파일러에서 반환된 컴파일 결과를 나타냅니다.

public ref class CompilerResults
public class CompilerResults
[System.Serializable]
public class CompilerResults
type CompilerResults = class
[<System.Serializable>]
type CompilerResults = class
Public Class CompilerResults
상속
CompilerResults
파생
특성

예제

// Displays information from a CompilerResults.
[PermissionSet(SecurityAction::Demand, Name="FullTrust")]
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( String::Concat( i, ": ", cr->Errors[ i ] ) );
   }
   else
   {
      
      // Display information ab->Item[Out] the* compiler's exit code and the generated assembly.
      Console::WriteLine( "Compiler returned with result code: {0}", cr->NativeCompilerReturnValue );
      Console::WriteLine( "Generated assembly name: {0}", cr->CompiledAssembly->FullName );
      if ( cr->PathToAssembly == nullptr )
               Console::WriteLine( "The assembly has been generated in memory." );
      else
               Console::WriteLine( "Path to assembly: {0}", 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) );
      }
   }
}
// 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 );
        }
    }
}
' Displays information from a CompilerResults.
Public Shared Sub DisplayCompilerResults(ByVal cr As System.CodeDom.Compiler.CompilerResults)
    ' If errors occurred during compilation, output the compiler output and errors.
    If cr.Errors.Count > 0 Then
        Dim i As Integer
        For i = 0 To cr.Output.Count - 1
            Console.WriteLine(cr.Output(i))
        Next i        
        For i = 0 To cr.Errors.Count - 1
            Console.WriteLine((i.ToString() + ": " + cr.Errors(i).ToString()))
        Next i
    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 Is Nothing Then
            Console.WriteLine("The assembly has been generated in memory.")
        Else
            Console.WriteLine(("Path to assembly: " + cr.PathToAssembly))
        End If
        ' Display temporary files information.
        If Not cr.TempFiles.KeepFiles Then
            Console.WriteLine("Temporary build files were deleted.")
        Else
            Console.WriteLine("Temporary build files were not deleted.")
            ' Display a list of the temporary build files
            Dim enu As IEnumerator = cr.TempFiles.GetEnumerator()
            Dim i As Integer
            i = 0
            While enu.MoveNext()
                Console.WriteLine(("TempFile " + i.ToString() + ": " + CStr(enu.Current)))
                i += 1
            End While
        End If
    End If
End Sub

설명

이 클래스는 인터페이스 구현에 의한 컴파일 ICodeCompiler 결과에 대한 다음 정보를 포함합니다.

  • 속성은 CompiledAssembly 컴파일된 어셈블리를 나타냅니다.

  • 속성은 Evidence 어셈블리에 대한 보안 증거를 나타냅니다.

  • 속성은 PathToAssembly 메모리에서만 생성되지 않은 경우 컴파일된 어셈블리의 경로를 나타냅니다.

  • 속성은 Errors 컴파일러 오류 및 경고를 나타냅니다.

  • 속성은 Output 컴파일러 출력 메시지를 포함합니다.

  • 속성은 NativeCompilerReturnValue 컴파일러에서 반환된 결과 코드 값을 나타냅니다.

  • 속성은 TempFiles 컴파일 및 연결 중에 생성된 임시 파일을 나타냅니다.

참고

이 클래스는 모든 멤버에 적용 되는 클래스 수준에서 상속 요청을 포함 합니다. SecurityException 파생된 클래스에는 완전 신뢰 권한이 없는 경우 throw 됩니다. 상속 요구 사항에 대한 자세한 내용은 상속 요구를 참조하세요.

생성자

CompilerResults(TempFileCollection)

지정된 임시 파일을 사용하는 CompilerResults 클래스의 새 인스턴스를 초기화합니다.

속성

CompiledAssembly

컴파일된 어셈블리를 가져오거나 설정합니다.

Errors

컴파일러 오류 및 경고의 컬렉션을 가져옵니다.

Evidence
사용되지 않음.

컴파일된 어셈블리의 보안 정책 권한을 나타내는 증명 정보 개체를 나타냅니다.

NativeCompilerReturnValue

컴파일러의 반환 값을 가져오거나 설정합니다.

Output

컴파일러 출력 메시지를 가져옵니다.

PathToAssembly

컴파일된 어셈블리의 경로를 가져오거나 설정합니다.

TempFiles

사용할 임시 파일 컬렉션을 가져오거나 설정합니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보