Comprehensive Guide: How To Check .NET Version Installed On Windows, MacOS, And Linux
Identifying the installed .NET version is essential for maintaining application compatibility, ensuring security patch currency, and resolving runtime exceptions during deployment. Whether you are operating on Windows, macOS, or Linux, you can verify your environment status using native command-line interfaces or by inspecting the registry and system directories to confirm exact build numbers and support lifecycles.
Prerequisites and Environment Preparation
Before attempting to verify your .NET framework or .NET Core installation, ensure you have appropriate administrative or user-level access to the command terminal. Checking version information does not typically require elevated privileges, though global environment variables must be correctly configured to ensure the runtime is discoverable by your shell.
- Essential Tools: Access to Command Prompt (Windows), PowerShell (Windows), Terminal (macOS/Linux).
- Mandatory Prerequisites: .NET SDK or Runtime must be installed and added to the System PATH.
- Verification Benchmarks: Ensure you are checking the output of the CLI tools directly; third-party software may report cached versions that do not align with the current active runtime.
- Estimated Duration: 2 to 5 minutes for full environment discovery.
- Budget Requirements: None; these tools are native to the .NET ecosystem and open-source distributions.
Procedural Workflow for Version Discovery Across Environments
Step 1: Querying via the .NET Command Line Interface
The most universal method to determine which versions of .NET are currently available to your system is by using the built-in CLI tool. This command returns the versions of the SDK and runtime that the system is currently using to execute applications.
- Open your preferred terminal application.
- Type the command dot net followed by a space and two dashes and the word list-sdks. This will display every Software Development Kit version installed on your machine.
- For runtime information, input dot net followed by a space and two dashes and the word list-runtimes. This list details every shared framework and runtime available for your applications to utilize.
- To view the primary version currently targeting your session, use dot net followed by a space and two dashes and the word version.
Pro-Tip: If your terminal returns an error stating that the command is not found, verify that the .NET installation folder is included in your system environment variables. You may need to restart your terminal session to refresh the path configuration.
Step 2: Extracting Version Data via Windows PowerShell
If you require a deep dive into the specific build numbers or if you are managing a Windows Server environment, PowerShell provides a more granular inspection method.
- Launch PowerShell with standard user permissions.
- Use the Get-ChildItem command directed at the registry keys where .NET Framework stores versioning data. The specific path is located under HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full.
- Execute the command to select the Release property. The output provides a DWORD value; you must cross-reference this value with the official Microsoft documentation table for .NET Framework versions, as the integer does not represent the version number directly.
Warning: Modifying registry values manually can destabilize your environment. Always perform read-only queries when checking versions through the Registry Editor or PowerShell.
Step 3: Inspecting System Directories on Linux and macOS
On Unix-based systems, .NET versions are stored within standard hierarchical directory structures. This is particularly useful when troubleshooting multiple side-by-side installations.
- Open your terminal and navigate to the directory located at /usr/local/share/dotnet/sdk or /usr/share/dotnet/sdk.
- List the contents of this folder by typing the list command.
- Each sub-directory name corresponds to the exact version number of the SDK installed.
- Repeat this process for the /usr/share/dotnet/shared/Microsoft.NETCore.App directory to identify the specific runtime versions available.
Qu'est-ce que l'IPv6 (Internet Protocol Version 6) ? | Coursera
Technical Specifications and Runtime Comparisons
Understanding the difference between the .NET Framework (the older, Windows-only implementation) and .NET (formerly .NET Core) is vital for proper version auditing. Use the following table to align your installation status with expected performance and compatibility standards.
| Feature Category | .NET Framework (4.8 and below) | .NET (5.0, 6.0, 7.0, 8.0+) |
|---|---|---|
| Platform Support | Windows Only | Cross-Platform (Win, Linux, Mac) |
| Architecture | Monolithic | Modular/Microservices-focused |
| Distribution | Windows Updates/System Installer | Standalone Installers/Package Managers |
| Registry Tracking | Highly dependent on Registry Keys | File system directory-based |
| Primary Query Method | PowerShell Registry Inspection | CLI (dotnet --list-runtimes) |
Common Installation Failures and Remediation
Even with standard installations, environment inconsistencies often lead to version reporting errors. Use these field fixes to resolve common discovery issues.
Issue: Command Not Found Error.
- Root Cause: The .NET executable is installed but not present in the system PATH environment variable, preventing the shell from locating the binary.
- Actionable Fix: Manually add the installation path (typically C:\Program Files\dotnet on Windows or /usr/local/share/dotnet on Linux) to your Environment Variables or profile configuration file and initiate a new terminal instance.
Issue: Discrepancy Between SDK and Runtime Versions.
- Root Cause: An update was partially applied, or a global.json file in your project directory is forcing a specific, older version of the SDK to override the system default.
- Actionable Fix: Check your root project folder for a global.json file. If present, delete or update it to match the desired SDK version. Use the dotnet --info command to see the active working directory context.
Issue: Registry Value Does Not Match Current Version.
- Root Cause: Incomplete cleanup of previous .NET Framework versions during an automated update or manual installation of side-by-side environments.
- Actionable Fix: Use the official Microsoft .NET Uninstall Tool to perform a clean sweep of corrupted or ghosted installations before re-installing the required version from the official .NET download portal.
Frequently Asked Questions
Is there a difference between the .NET SDK and the Runtime?
Yes, the Runtime contains only the components necessary to run existing .NET applications, whereas the SDK includes the Runtime along with all the tools, libraries, and compilers required to build, test, and package new .NET applications.
Why does my machine show multiple .NET versions?
.NET is designed to support side-by-side installation, allowing different applications to run on specific versions simultaneously without conflict. This ensures that updating a system-wide version does not break legacy software that relies on older, specific frameworks.
How do I identify the exact patch version?
Running the command dot net followed by two dashes and version provides the major and minor versions, while dot net followed by two dashes and list-sdks displays the full semantic version including build and patch iterations.
Can I run different versions of .NET on the same server?
Absolutely. The .NET architecture is specifically built to handle multiple concurrent versions. You can manage which version a project uses by utilizing a global.json file or by targeting specific versions in your project build configuration file.
Elevate Your Development Environment
Maintaining an accurate audit of your installed .NET versions is the first step toward building stable, high-performance, and secure enterprise applications. Implement these verification workflows into your standard deployment checklist to ensure total environmental consistency across your development and production lifecycles.
