mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2026-04-18 04:33:54 +00:00
Initial commit
This commit is contained in:
parent
d0eb68594c
commit
c0d4d11b54
24 changed files with 463 additions and 0 deletions
17
vscode/Chapter07/DotNetEverywhere/DotNetEverywhere.csproj
Normal file
17
vscode/Chapter07/DotNetEverywhere/DotNetEverywhere.csproj
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RuntimeIdentifiers>
|
||||
win10-x64;osx-x64;osx.11.0-arm64;linux-x64;linux-arm64
|
||||
</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="System.Console" Static="true" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
21
vscode/Chapter07/DotNetEverywhere/Program.cs
Normal file
21
vscode/Chapter07/DotNetEverywhere/Program.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
WriteLine("I can run everywhere!");
|
||||
WriteLine($"OS Version is {Environment.OSVersion}.");
|
||||
|
||||
if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
WriteLine("I am macOS.");
|
||||
}
|
||||
else if (OperatingSystem.IsWindowsVersionAtLeast(major: 10, build: 22000))
|
||||
{
|
||||
WriteLine("I am Windows 11.");
|
||||
}
|
||||
else if (OperatingSystem.IsWindowsVersionAtLeast(major: 10))
|
||||
{
|
||||
WriteLine("I am Windows 10.");
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteLine("I am some other mysterious OS.");
|
||||
}
|
||||
WriteLine("Press ENTER to stop me.");
|
||||
ReadLine();
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
dotnet publish -c Release -r win10-x64
|
||||
dotnet publish -c Release -r osx-x64
|
||||
dotnet publish -c Release -r osx.11.0-arm64
|
||||
dotnet publish -c Release -r linux-x64
|
||||
dotnet publish -c Release -r linux-arm64
|
||||
Loading…
Add table
Add a link
Reference in a new issue