3

Is it possible to find out the project folder/project file or output path of the assembly during compile time in Postsharp, i.e. during CompileTimeInitialize for example, when the assembly is being built?

Anupheaus
  • 3,383
  • 2
  • 24
  • 30

1 Answers1

3

You can find out the path to the current project file by evaluating the 'MSBuildProjectFullPath' property during compile time:

public override void CompileTimeInitialize(MethodBase method, AspectInfo aspectInfo)
{
    string projectPath =
        PostSharpEnvironment.CurrentProject
            .EvaluateExpression("{$MSBuildProjectFullPath}");
}

The list of some other PostSharp properties can be found on this documentation page.

AlexD
  • 5,011
  • 2
  • 23
  • 34