I have an ASP.NET WebForms application which requires .NET Framework 4.8 (or higher). I want the application to "fail early" if the required framework version is unavailable (e.g. on a system with only 4.7 installed). In other words, I want something like the supportedRuntime
tag for executables, just for web applications.
Can this be achieved via some web.config setting? I have tried:
- system.web/httpRuntime/targetFramework
- system.web/compilation/targetFramework
- startup/supportedRuntime/sku (just for completeness, I didn't expect it to work)
I.e.:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
...
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<system.web>
<httpRuntime targetFramework="4.8" />
<compilation targetFramework="4.8" />
...
</system.web>
</configuration>
However, the web application still happily runs on a server with only .NET Framework 4.7 installed.
Did I miss anything or is this feature just not available?