Megosztás a következőn keresztül:


CompilationLibrary Class

Definition

Represents a compile time library dependency in a dependency manifest.

public ref class CompilationLibrary : Microsoft::Extensions::DependencyModel::Library
public class CompilationLibrary : Microsoft.Extensions.DependencyModel.Library
type CompilationLibrary = class
    inherit Library
Public Class CompilationLibrary
Inherits Library
Inheritance
CompilationLibrary

Examples

The following example shows how to display the list of libraries used to compile the current application. Include <PreserveCompilationContext>true</PreserveCompilationContext> in your project file to run this example.

foreach (CompilationLibrary lib in DependencyContext.Default.CompileLibraries)
{
    Console.WriteLine($"Library: {lib.Name} {lib.Version}");
    Console.WriteLine($"Type:    {lib.Type}");
    Console.WriteLine("Reference paths:");

    foreach (string path in lib.ResolveReferencePaths())
    {
        Console.WriteLine(path);
    }
}

Remarks

A compile time library dependency is a library used to compile an application. It can be a reference assembly or an implementation assembly. You can use the CompileLibraries property to get the list of compile time library dependencies for a dependency context. This is useful when you need to dynamically compile code (for example, using Roslyn Emit API) referencing the same dependencies as your main application.

Constructors

CompilationLibrary(String, String, String, String, IEnumerable<String>, IEnumerable<Dependency>, Boolean, String, String)

Initializes a new instance of the CompilationLibrary class using the specified library properties and path.

CompilationLibrary(String, String, String, String, IEnumerable<String>, IEnumerable<Dependency>, Boolean)

Initializes a new instance of the CompilationLibrary class using the specified library properties.

Properties

Assemblies

Gets the list of assemblies for this library.

Dependencies

Gets the list of dependencies of this library.

(Inherited from Library)
Hash

Gets the hash of the package, if this library is a package.

(Inherited from Library)
HashPath

Gets the relative path to the library package hash file, if this library is a package.

(Inherited from Library)
Name

Gets the library name.

(Inherited from Library)
Path

Gets the relative path to package assets, if this library is a package.

(Inherited from Library)
RuntimeStoreManifestName (Inherited from Library)
Serviceable

Gets a value that indicates whether this library can be serviced, if this library is a package.

(Inherited from Library)
Type

Gets the type of this library.

(Inherited from Library)
Version

Gets the version of this library.

(Inherited from Library)

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ResolveReferencePaths()

Gets the collection of absolute reference paths for this library.

ResolveReferencePaths(ICompilationAssemblyResolver[])

Gets the collection of absolute reference paths for this library using specified custom resolvers.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to