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.

Developer technologies | Windows Presentation Foundation
Developer technologies | Visual Studio | Debugging
Windows for business | Windows Client for IT Pros | User experience | Other
Developer technologies | Visual Studio | Other
Developer technologies | C#
{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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.