I want to conditionally undefine DEBUG
if it's a publish build.
is there a property I can check to see if we're currently publishing?
See this issue-comment in the dotnet/sdk
repository. Microsoft seemingly introduced the MSBuild-variable _IsPublishing
which can be used to check if we're in a publish-build.
This variable will contain yes
if we are indeed doing dotnet publish
and is empty if we are not.
Note however, that this variable will not be set, when using dotnet build /t:Publish
or msbuild /t:Publish
.