Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Require the .NET 4.0 Full profile with <supportedRuntime />

We have an application that supports both .NET 2.0 and .NET 4.0 and we switch the few framework dependent assemblies with <bindingRedirect />. We've used the <supportedRuntime /> element to allow the application to run using the latest framework if available. However, we do still require the full profile, not just the client profile.

The documentation for .NET 3.5 indicates that you must explicitly opt-in to client only support by adding a sku="client" attribute to the <supportedRuntime /> element.

The sku attribute name is case-sensitive. If the sku attribute is missing, or if its value is set to anything other than "client", the runtime assumes the application is not a .NET Framework Client Profile application.

However, with .NET 4.0 detailed documentation on the sku attribute is missing. In our tests the .NET runtime will use the .NET 4.0 client profile even if the sku attribute is missing. This is a problem since it doesn't allow dynamic redirection with the .config file. I've tried to use sku="full" to try and force it to only use the full profile but that just results in no .NET 4.0 runtime being supported.

The question

Does anyone know of a way to force the use of the full .NET profile when using <supportedRuntime /> (or other comparable solution) to support multiple .NET framework versions?

Snippet from our .config file

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0.30319" />
        <supportedRuntime version="v2.0.50727" />
    </startup>

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" 
                         appliesTo="v4.0.30319">

            <dependentAssembly>
                <assemblyIdentity name="Application"
                                  publicKeyToken="798276055709c98a"
                                  />

                <bindingRedirect oldVersion="4.1.2000.0"
                                 newVersion="4.1.4000.0" />

                <codeBase version="4.1.4000.0"
                          href="Redistributable\.NET 4.0\Application.dll" />

            </dependentAssembly>
         </assemblyBinding>
    </runtime>
</configuration>
like image 463
Paul Alexander Avatar asked Oct 10 '22 11:10

Paul Alexander


1 Answers

My understanding is this would work:

<supportedRuntime version="v4.0.30319" sku=".NETFramework,Version=v4.0.1" />
<supportedRuntime version="v4.0.30319" sku=".NETFramework,Version=v4.0" />

There is no Profile=Full, but the Profile is meant to restrict to a smaller SKU per my understanding.

The list of installed SKUs can be found at

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs
like image 115
Gregory A Beamer Avatar answered Dec 03 '22 11:12

Gregory A Beamer