I have the following code:
#if PC
var rootPath = Path.Combine("dist");
#else
var rootPath = Path.Combine(@"/bin/bash");
#endif
I want to write different batch files when publishing the program to decide whether to add the macro "PC" or not.
But I didn't find the answer under the dotnet publish command.
Add a configuration (Pc) in your .csproj file, and add the
PCsymbol:Use
-coption to pick this configuration:Use msbuild's
-getPropertyand-poptions to define the symbols: