0

We're developing several .NET web applications, both on the old (.NET Framework 4.8) and new stack (.NET 6). On production, we want to determine on which .NET runtime each application is running.

I could add something like RuntimeInformation.FrameworkDescription to the startup code of each web application and log it.

I'd like to know whether there is a more elegant solution, e. g. via a tool. I played around with both dotnet-monitor and dotnet-counters, but I didn't find any API which returns the .NET runtime version of the .NET process.

Thx!

3
  • For .NET Core based versions, use Environment.Version. For .NET Framework, I think the best way is to use the registry (you'll find posts about how to do that) Commented Nov 15, 2022 at 12:13
  • 1
    Could you please elaborate on why you wouldn't use RuntimeInformation.FrameworkDescription? Commented Nov 15, 2022 at 12:16
  • Oh, because I didn't fully read your post :-( That seems to be what you need, indeed. At least as long as you're only using the string for logging and not to parse it in some form. Commented Nov 15, 2022 at 12:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.