CompilationLibrary Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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);
}
}
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.
Compilation |
Initializes a new instance of the CompilationLibrary class using the specified library properties and path. |
Compilation |
Initializes a new instance of the CompilationLibrary class using the specified library 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) |
Hash |
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) |
Runtime |
(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) |
Resolve |
Gets the collection of absolute reference paths for this library. |
Resolve |
Gets the collection of absolute reference paths for this library using specified custom resolvers. |
Продукт | Версии |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Отзыв о .NET
.NET — это проект с открытым исходным кодом. Выберите ссылку, чтобы оставить отзыв: