Post­Sharp Documentation / Deployment and Configuration / Configuration / Configuring Projects in Visual Studio

Configuring Projects in Visual Studio

PostSharp accepts several configuration settings such as the version and processor architecture of the CLR that is used at build time, the search path of dependencies, and whether some features are enabled.

Although the default configuration is appropriate for most situations, you may have to fine-tune some of them to cope with particular cases.

Most common properties can be edited directly from Visual Studio using the PostSharp project property page.

This topic contains the following sections:

Opening PostSharp project properties tab

To open the PostSharp project property page in Visual Studio

  1. Open the Solution Explorer.

  2. Right-click on the project then select Properties at the bottom of the menu.

  3. Select the PostSharp tab.

The PostSharp property page in the Visual Studio project properties dialog.
Project Property Page
Understanding configuration settings

Note that all settings are dependent on the selected project configuration (for instance Debug) and platform (for instance Any CPU).

Setting

Description

Disable PostSharp

True if PostSharp should not execute in for the selected configuration and platform, otherwise False. This setting maps to the MSBuild property SkipPostSharp.

Additional search path

A semicolon-separated list of directories where plug-ins and libraries have to be searched for. This property can reference other MSBuild properties, for instance: ..\MyWeaver\bin\$(Configuration). All project references are already added to the search path by default. This setting maps to the MSBuild property PostSharpSearchPath.

Additional properties

A semicolon-separated list of property definition, for instance: Name1=Value1;Name2=Value2. This property can reference other MSBuild properties, for instance: RootNamespace=$(RootNamespace). Several properties are defined by default; for details, see Well-Known PostSharp Properties. This setting maps to the MSBuild property PostSharpProperties

Suppress warnings

A semicolon-separated list of warning identifiers that must be ignored, or * if all warnings have to be ignored. This setting maps to the MSBuild property PostSharpDisabledMessages.

Treat warnings as errors

A semicolon-separated list of warning identifiers that must be escalated into errors, or * if all warnings must be treated as errors. This setting maps to the MSBuild property PostSharpEscalatedMessages.

Architecture Validation

Enabled if constraints must be validated, otherwise Disabled. The default value is Enabled. For details regarding architecture validation, see Validating Architecture.

CLR Version

The version of the CLR that hosts PostSharp. PostSharp currently only supports the CLR 4.0 so this setting is disabled. This setting maps to the MSBuild property PostSharpTargetFrameworkVersion.

Processor Architecture

The processor architecture (x86 or x64) of the process hosting PostSharp. Since PostSharp needs to execute the current project during the build, the processor architecture of the PostSharp process must be compatible with the target platform of the current project. The default value is x86, or x64 if the target platform of the current project is x64. This setting maps to the MSBuild property PostSharpTargetProcessor.

Build Host

The kind of process hosting PostSharp, which influences the assembly loading mechanism, compatibility and performance features. This setting maps to the MSBuild property PostSharpHost. For details, see Configuring Projects Using MSBuild.

Optimization Mode

When set to Build Time, PostSharp will use a faster algorithm to generate the final assembly. When set to Size, PostSharp will use a slower algorithm that generates smaller assemblies. The default value is Build Time by default, or Size when the C# or VB compiler is set to generate optimal code (typically, in release builds). This settings maps to the MSBuild property PostSharpOptimizationMode.