Disable Postsharp in debug builds for entire solution
Asked Answered
P

2

5

I have a solution with many projects and I would like to disable Postsharp for debug builds to reduce local developer build times. Is there any way to do this without editing each project file?

I know this may sound like a bad idea, but we are only using Postsharp for exception logging and our builds go through several environments for automated/manual testing (which would use a release build), so we would pick up on any potential issues at this point.

If it helps, Postsharp was added to the projects via nuget.

Porshaport answered 3/4, 2012 at 9:27 Comment(0)
W
7

You can define the compilation symbol (constant) "SkipPostSharp" for Debug mode only.

Whitechapel answered 3/4, 2012 at 10:2 Comment(4)
Thanks Gael. Is there a way to do this for the entire solution without editing each project's settings?Porshaport
Yes, you can use a file named PostSharp.Custom.targets as documented in doc.sharpcrafters.com/postsharp-2.1/Content.aspx/…Whitechapel
See also the following related question: #9815109Whitechapel
For Visual Studio for Mac Community edition v8.10, this can be done under Project -> <Project Name> Options -> Compiler -> Define Symbols -> add SkipPostSharp into the ';' separated listTernary
I
3

I don't know how to do it for the entire solution, but it can be done easily per project.

  1. Project > Setting > PostSharp

  2. Choose Yes for Disable PostSharp for this configuration

Disable PostSharp

Interdict answered 3/6, 2015 at 15:27 Comment(1)
This doesn't work if one hasn't got PostSharp installed.Onagraceous

© 2022 - 2024 — McMap. All rights reserved.