Metalama 1.0 / / Metalama Documentation / Aspect API / Metalama.​Framework.​Project / IProject

Interface IProject

Exposes the properties of the current C# project, such as Path, AssemblyReferences, PreprocessorSymbols, Configuration or TargetFramework. To access a custom MSBuild property, use TryGetProperty(String, out String). You can extend this interface with your own framework-specific by using the Extension<T>() method.

Namespace: Metalama.Framework.Project
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface IProject

Properties

Name Description
AssemblyReferences

Gets the list of assembly references of the current project.

Configuration

Gets the name of the build configuration, for instance Debug or Release.

Name
Path

Gets the path to the csproj file.

PreprocessorSymbols

Gets the list of defined preprocessor symbols like DEBUG, TRACE, NET5_0_OR_GREATER and so on.

ServiceProvider

Gets an IServiceProvider<TBase> that gives access to the compiler services exposed using the [CompileTimePlugIn] facility. Only interfaces that derive from IProjectService are accessible from this property.

TargetFramework

Gets the identifier of the target framework, for instance netstandard2.0.

Methods

Name Description
Extension<T>()

Gets a project extension object or creates a new instance if none has been created before. The type must derive from ProjectExtension and have a default constructor. New instances will be initialized using Initialize(IProject, Boolean).

TryGetProperty(String, out String)

Gets the set of properties passed from MSBuild. To expose an MSBuild property to this collection, define the CompilerVisibleProperty item.

Extension Methods

DependencyInjectionExtensions.DependencyInjectionOptions(IProject)