I publish my .NET Core app using dotnet publish -r linux-x64
, so it is self-contained and .NET Core runtime is not installed on the server where it runs. It's being built using .NET Core 2.1.something - I think. How do I get the exact version to know for sure? Ideally I'd like to get this at runtime, so the application itself can report what runtime it's running on, but even if there is some SDK tool that reports it (like dotnet get-runtime-version My.Assembly.Dll
) that's better than nothing.
相关问题
- Dotnet Core API - Get the URL of a controller meth
- Why am I unable to run dotnet tool install --globa
- Singleton with AsyncLocal vs Scope Service
- What would prevent code running in a Docker contai
- .NET Core gives unknown error while processing HTT
相关文章
- DotNet Core console app: An assembly specified in
- EF Core 'another instance is already being tra
- Re-target .NET Core to net471, net 472
- Publishing a Self-contained Console app fails
- Calling a .Net Framework 4 (or Mono) assembly from
- Can't get deleted items from OpenLDAP Server u
- proper way to sign .net core assembly
- Should I cache and reuse HttpClient created from H
When the application is published, it will generate
My.Assembly.deps.json
and this contains the information about the included runtime. Look for the version ofMicrosoft.NETCore.App
that is referenced.Example (trimmed only to the relevant properties):
deps.json
is further documented in Runtime Configuration Files as part of the .NET Core CLI spec, although it doesn't directly define the relationship to the runtime version.