Karl
Karl

Reputation: 659

PostSharp build targets not running when using Debug configuration

I have setup a Visual Studio project that I have edited to reference the PostSharp build targets. I did not use the MSI installed to install PostSharp on my development machine.

The problem that I am having is that the PostSharp Targets are only executed when I change the build configuration to 'Release', but not in 'Debug'.

I can verify this by looking at the build output which includes the line when in Release:

PostSharp 1.5 [1.5.6.627] - Copyright (c) Gael Fraiteur, 2005-2009.

Looking at the project file, I do not see anything obvious that would suggest PostSharp would run with one configuration and not the other. How can I configure PostSharp to run during both Debug and Release configuration? Keeping in mind, I would rather avoid using the installer.

Karl

EDIT csproj snippent, appears at the bottom of file, below <ItemGroup>:

<PropertyGroup>
    <DontImportPostSharp>True</DontImportPostSharp>
    <PostSharpDirectory>..\..\tools\postsharp-1.5.6.629</PostSharpDirectory>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(PostSharpDirectory)\PostSharp-1.5.targets" />

Upvotes: 1

Views: 4532

Answers (1)

Hans Passant
Hans Passant

Reputation: 942119

Look at the location of the <Import> element in the project file that imports PostSharp.targets. There are normally three <PropertyGroup> elements in the project file. One for general settings, one for Debug only settings and one for Release only settings. Move the <Import> element if it is in the Release group, it should appear after the Import element for Microsoft.CSharp.targets.

Upvotes: 2

Related Questions