Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CompilerResults Class

 

Represents the results of compilation that are returned from a compiler.

Namespace:   System.CodeDom.Compiler
Assembly:  System (in System.dll)

System.Object
  System.CodeDom.Compiler.CompilerResults
    System.Workflow.ComponentModel.Compiler.WorkflowCompilerResults

<SerializableAttribute>
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Name := "FullTrust")>
Public Class CompilerResults

NameDescription
System_CAPS_pubmethodCompilerResults(TempFileCollection)

Initializes a new instance of the CompilerResults class that uses the specified temporary files.

NameDescription
System_CAPS_pubpropertyCompiledAssembly

Gets or sets the compiled assembly.

System_CAPS_pubpropertyErrors

Gets the collection of compiler errors and warnings.

System_CAPS_pubpropertyEvidence

Obsolete. Indicates the evidence object that represents the security policy permissions of the compiled assembly.

System_CAPS_pubpropertyNativeCompilerReturnValue

Gets or sets the compiler's return value.

System_CAPS_pubpropertyOutput

Gets the compiler output messages.

System_CAPS_pubpropertyPathToAssembly

Gets or sets the path of the compiled assembly.

System_CAPS_pubpropertyTempFiles

Gets or sets the temporary file collection to use.

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

This class contains the following information about the results of a compilation by an ICodeCompiler interface implementation:

  • The CompiledAssembly property indicates the compiled assembly.

  • The Evidence property indicates the security evidence for the assembly.

  • The PathToAssembly property indicates the path to the compiled assembly, if it was not generated only in memory.

  • The Errors property indicates any compiler errors and warnings.

  • The Output property contains the compiler output messages.

  • The NativeCompilerReturnValue property indicates result code value returned by the compiler.

  • The TempFiles property indicates the temporary files generated during compilation and linking.

System_CAPS_noteNote

This class contains an inheritance demand at the class level that applies to all members. A SecurityException is thrown when the derived class does not have full-trust permission. For details about inheritance demands, see Inheritance Demands.

' 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

SecurityAction.InheritanceDemand

for full trust for inheritors. This class cannot be inherited by partially trusted code.

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2017 Microsoft