Environment.OsVersion returns wrong OS info

M. Azeem 15 Reputation points
2023-06-12T10:35:11.5333333+00:00

On Microsoft Windows NT 10.0.19045.0, I am reading OS info by

Environment.OSVersion

When I run app.exe by double click on it, OS Info is read Microsoft Windows NT 10.0.19045.0 but when I run code in visual studio 2022, OS Info is read Microsoft Windows NT 6.0.6002 Service Pack 2.

What setting should be done in visual studio for the correct OS read during my debugging? Please guide.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,932 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,695 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,753 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,469 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
958 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more