RJCP.Core.Environment 0.3.0

dotnet add package RJCP.Core.Environment --version 0.3.0                
NuGet\Install-Package RJCP.Core.Environment -Version 0.3.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RJCP.Core.Environment" Version="0.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RJCP.Core.Environment --version 0.3.0                
#r "nuget: RJCP.Core.Environment, 0.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install RJCP.Core.Environment as a Cake Addin
#addin nuget:?package=RJCP.Core.Environment&version=0.3.0

// Install RJCP.Core.Environment as a Cake Tool
#tool nuget:?package=RJCP.Core.Environment&version=0.3.0                

RJCP.Environment

This library contains miscellaneous routines that are useful for getting information about the environment.

This document covers two assemblies, RJCP.Core.Environment and RJCP.Core.Environment.Version

1. Environment Features

1.1. Platform Version

Provides a standard way across .NET Framework and .NET Core. .NET 6.0 and later have introduced their own mechanism, so if your projects don't target older versions, use the immplementations from .NET Core.

  • IsWinNT()
  • IsUnix() for Linux (support for MacOS is removed as this is not tested).

These APIs support the newer SupportedOSPlatform attributes in .NET Core 6.0 and later (the attribute is from .NET 5.0, but .NET 6.0 supports the guards).

In addition, further runtimes can be detected:

  • IsMonoClr()
  • IsMSys() by checking environment variables - useful with RJCP.Core.CommandLine.
  • IsCygwin() by checking environment variables - useful with RJCP.Core.CommandLine.

1.2. XDG Specification on Linux

The Platform.GetFolderPath method supports getting standard paths according to the XDG standard.

The following properties are supported:

  • Environment.SpecialFolder.LocalApplicationData
  • Environment.SpecialFolder.CommonApplicationData
  • Otherwise the base .NET implementation is used. This might change in the future if the XDG supports further features.

Additionally, the APIs Xdg.GetFolderPath is provided with:

  • Xdg.SpecialFolder.LocalApplicationData
  • Xdg.SpecialFolder.CommonApplicationData
  • Xdg.SpecialFolder.CacheData

that rely on XDG_ environment variables.

2. Environment.Version Features

Since version 0.3.0, functionality has moved from Environment to here.

2.1. Windows Version

With WinVersion.LocalMachine get the version of the current operating system using NTDLL. You can compare against other versions in detail, get Windows version information, useful for informational reports. Use the existing functionality in the .NET framework to test against features, and do not use the Windows version.

2.2. .NET Framework Version

Use NetVersions to enumerate a list of installed versions of .NET Framework, and the current runtime in use.

To date, there is no documented standard on querying the versions of the .NET Core runtimes, so this isn't offered.

It checks against MONO on Linux as well as Windows.

3. Tools

3.1. WinVersion

The repository offers a tool (not provided as a binary) that can be used to show windows version information.

3.2. NetVersion

The repository offers a tool (not provided as a binary) that can be used to show the .NET Framework version information.

4. Release History

4.1. Environment

4.1.1. Version 0.3.0

Features:

  • Add function to test if binary is running from a Cygwin Shell (DOTNET-931)

Quality:

  • Add README.md to NuGet package (DOTNET-805)
  • Move out Version information, so that there are less dependencies and remove cyclic dependencies, as most code uses this library for platform information. (DOTNET-851)
  • Upgrade to .NET Core 6.0 (DOTNET-936)
  • Add references for OS Compatibility (DOTNET-938, DOTNET-942, DOTNET-959)

4.2. Environment.Version

4.2.1. Version 0.3.0

Features:

  • NetVersion: Search for Mono 4.2.1 and later (DOTNET-848)
  • NetVersion: Search for Mono 1.x to 4.0.3 (DOTNET-849)
  • NetVersion: Use the current MonoRuntime to also determine the installed location (DOTNET-851)
  • NetVersion: Search the path on Windows for other installations of Mono (DOTNET-858)
  • NetVersion: Use the current MonoRuntime on Linux to also determine the installed location (DOTNET-863)
  • WinVersion: Add Windows RT 8.1 ARM to a test case (DOTNET-859)

BugFixes:

  • NetVersion: Fix and test .NET 1.0 to .NET 4.8.1, fixing especially the detection of .NET 3.0 (DOTNET-843, DOTNET-844, DOTNET-846)
  • NetVersion: Only return one current runtime (DOTNET-850)

Quality:

  • Add README.md to NuGet package (DOTNET-805)
  • NetVersion: Provide the Target Version as a Version object (DOTNET-842, DOTNET-845)
  • Code cleanup (DOTNET-848)
  • Add references for OS Compatibility (DOTNET-938)
  • Upgrade to .NET Core 6.0 (DOTNET-936, DOTNET-940, DOTNET-942, DOTNET-959, DOTNET-963)
  • Add .NET 4.8 target, and enable usage of APIs without reflection (DOTNET-976)

4.3. Version 0.2.0

  • Initial Release
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.0

  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on RJCP.Core.Environment:

Package Downloads
RJCP.IO.Device

Get Windows Device Information.

RJCP.CodeQuality

Common functions to augment unit and integration testing, with some focus on the NUnit Test Framework.

RJCP.Diagnostics.CpuId

A library to query CPU Identification information.

RJCP.Core.CommandLine

Simplify the task of parsing the command line by specifying command line options using attributes on your class properties.

RJCP.IO.Path

Functions to work with and manipulate paths for Unix and Windows.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.0 12,249 3/9/2024
0.2.0 1,992 6/9/2023