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!

mu88
  • 4,156
  • 1
  • 23
  • 47
  • 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) – PMF Nov 15 '22 at 12:13
  • 1
    Could you please elaborate on why you wouldn't use `RuntimeInformation.FrameworkDescription`? – mu88 Nov 15 '22 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. – PMF Nov 15 '22 at 12:23

0 Answers0