Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 790 Bytes

netcore-platform-environment.md

File metadata and controls

47 lines (33 loc) · 790 Bytes

netcore platform environment

detect os type

var isFreeBSD = RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD);
var isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
var isOSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

DEBUG macro

#if DEBUG
  Console.WriteLine("debug mode");
#endif

the code will included in Debug but not in Release mode

debug execution

dotnet run

or build and run faster 2th times directly

dotnet build
dotnet bin/Debug/netcoreapp3.0/myapp.dll

release execution

dotnet run -c Release

or build and run faster 2th times directly

dotnet build -c Release
dotnet bin/Debug/netcoreapp3.0/myapp.dll