c# - How to pass compilation directive into other projects in dotnet core? -


if run entry project below, see nothing on screen expected since there no debug or trace directives in define.

the moment call helper.tracetest(); consumer project displays output. means consumer project ignores definition set on entry project.

there no define entry set in consumer project's and/or helper project's project.json file

if explicitly set consumer project's project.json obeys expected.

so there ugly way of making work if set in each project.json , wonder if there elegant way of defining solution wise?

thanks in advance.

entry project

project.json

// ... "configurations": {   "release": {     "buildoptions": {       "define": []     }   },   "debug": {     "buildoptions": {       "define": []     }   } }, //... 

program.cs

public class program {     public static void main(string[] args)     {  #if trace             console.writeline ("hello world main method"); #endif              tracetest();              helper.tracetest();          }     }  [conditional("trace")] private static void tracetest() {     console.writeline("hello world program class"); } 

helper project

helper.cs

public static class helper {     [conditional("trace")]     public static void tracetest()     {         console.writeline("hello world helper class");     } } 

consumer project

consumer.cs

public static class consume {     public static void run()     {         helper.tracetest();     } } 


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -