Sdk: Emit $(DefineConstants);RELEASE for release configuration.

Created on 16 Dec 2016  路  11Comments  路  Source: dotnet/sdk

Today, as part of migration we have to emit the following:

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
  </PropertyGroup>

We do that because project.json had this defineconstants in it, so, to keep the behavior the same for migrated projects, we have to emit it as well.

Would it be possible to emit this in SDK itself?

cc @dsplaisted

Bug

All 11 comments

We're going to need this in order to maintain parity with how both classic CSPROJ and project.json defaulted, without requiring the addition of the constant in every single new CSPROJ project.

This seems fine to me, but I think there was some discussion about it before I joined the team and the decision then was to leave it out. @srivatsn @nguerrera @davkean any opinions here?

I'm fine with it. Do we want a magic define based on configuration as with target framework?

@nguerrera yes please! Although I prefer the term "default" to "magic" :wink:

We already define DEBUG so I don't know why we wouldn't define RELEASE. Probably just an oversight.

@nguerrera it seems the defines for target frameworks are already there

@DamianEdwards Yes, they are. I'm asking if we want the same technique applied to $(Configuration). If I define Configuration=Checked, do I get #define CHECKED or is the request to just have DEBUG and RELEASE. I think we should make it open ended and automatic just like the TFM define.

Oh I see, that sounds nice.

BTW, what would it take to get statement completion for the defines?

@DamianEdwards I don't know. @CyrusNajmabadi? I presume you'd start by filing an issue on https://github.com/dotnet/roslyn ;)

cc @davkean as well on that last question.

Was this page helpful?
0 / 5 - 0 ratings