Last active
April 25, 2022 10:15
-
-
Save naramdash/3f0fb936492d4062648e020ee9d07369 to your computer and use it in GitHub Desktop.
C# Preprocessor with Operating System
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if Windows | |
Console.WriteLine("Windows!"); | |
#elif Linux | |
Console.WriteLine("Linuxw!"); | |
#elif OSX | |
Console.WriteLine("osx!"); | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<TargetFramework>netcoreapp3.1</TargetFramework> | |
<RootNamespace>notepad_asp</RootNamespace> | |
</PropertyGroup> | |
<PropertyGroup> | |
<DefineConstants Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">Windows</DefineConstants> | |
<DefineConstants Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">OSX</DefineConstants> | |
<DefineConstants Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">Linux</DefineConstants> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="6.0.1" /> | |
</ItemGroup> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment