Question

I have PostSharp included in all of my projects, as per the recommended best practices for PostSharp. However, I don't have any aspects or other transformations in some of these assemblies; they just reference other projects that do have aspects in use.

At build time, I get the following warning:

The module 'xxxxxxx.dll' does not contain any aspect or other transformation. For improved build-time performance, consider disabling PostSharp for this module by setting the compilation symbol (aka constant) 'SkipPostSharp' in your project, or set the MSBuild property 'SkipPostSharp=True'.

Thanks for the info, PostSharp! But I've "considered disabling PostSharp for this module" and decided not to do so. I'm perfectly happy to lose a tiny bit of build-time performance, in exchange for not having to think about it later when I do decide to use PostSharp in a project previously devoid of aspects.

How do I get PostSharp to stop telling me about this hint, and without enabling SkipPostSharp?

Was it helpful?

Solution

In your project properties under the PostSharp tab there is a line entry "Disabled Messages (semi-colon separated list)"

In that field enter the code for the particular message. I am not entirely sure what it is but try PS0121

Alternatively, if you manually edit your project file "*.csproj" you can add the PostSharpDisableMessages element into your PropertyGroup for your applicable configurations as shown below.

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
    <PostSharpDisabledMessages>PS0131;PS0121</PostSharpDisabledMessages>
  </PropertyGroup>

OTHER TIPS

You can quiet down these warnings from all the projects in your solution by adding a file to the solution folder called PostSharp.Custom.targets with the content:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PostSharpDisabledMessages>LA0156;PS0131</PostSharpDisabledMessages>
  </PropertyGroup>
</Project>

Where LA0156;PS0131 is a semicolon delimited list of the warnings you want to disable.

Specifically PS0131 disables

The project '<assembly name>' does not contain any aspect or other transformation. You can disable PostSharp for this project by editing the project properties in Visual Studio. Remember to enable PostSharp back if you add an aspect to this project.

And LA0156 disables

Missing code saving information on aspect type "<full type name>". Code saving metrics will be inaccurate. Add [LinesOfCodeAvoided] to the aspect class or specify the LinesOfCodeAvoided property of the advice custom attribute or ignore the warning LA0156.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top