zzarchive-fsharp-dnx icon indicating copy to clipboard operation
zzarchive-fsharp-dnx copied to clipboard

User Defined Compile Time constants

Open dbwz8 opened this issue 9 years ago • 1 comments

Ok, I decided to just sprout this as a new issue (since everything I've tried doesn't work, and we're completely blocked at this point).

AFAICT, the .xproj file should support: <DefineConstants> in the Globals PropertyGroup. It's ignored.

However, the Project.json file appears to be the right place and should support define (according to online docs):

  "compilationOptions": {
     "optimize": true,
     "emitEntryPoint": true,
     "define": ["TRUE","PORTABLE"]
  },

It's ignored.

The other approach is to put it in a configuration:

  "configurations": {
    "Debug": {
      "compilationOptions": {
        "define": ["DEBUG", "TRACE", "TRUE","PORTABLE"]
      }
    },
    "Release": {
      "compilationOptions": {
        "define": ["RELEASE", "TRACE", "TRUE","PORTABLE"],
        "optimize": true
      }
    }
  },

but that's also ignore.is also ignored.

Is this expected at this time, or am I doing something wrong?

For sanity checking, I added some compile time warnings to the code and then turned on warningsAsErrors in both of the last two examples... made no difference, so my guess is that these sections are being completely ignored at this point.

dbwz8 avatar Dec 31 '15 22:12 dbwz8

You're right. It should be in project.json, and it's ignored. Also, as far as I know, DNX is going away, so I'm not sure there is any point in continuing adding features to this. The "new way" is dotnet CLI. Someone else has (as far as I know) already made F# support for that (it's a lot simpler). Whether or not it support custom constants though, I have no clue.

Leaving the issue open for now though, until I know for sure that DNX is really dead (dying).

Alxandr avatar Jan 06 '16 21:01 Alxandr