需要带有< supportedRuntime />的.NET 4.0完整配置文件。 [英] Require the .NET 4.0 Full profile with <supportedRuntime />

查看:111
本文介绍了需要带有< supportedRuntime />的.NET 4.0完整配置文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个同时支持.NET 2.0和.NET 4.0的应用程序,并且使用< bindingRedirect /> 切换了一些依赖于框架的程序集。我们使用< supportedRuntime /> 元素来允许应用程序使用最新的框架(如果有)运行。但是,我们仍然需要 full 配置文件,而不仅仅是 client 配置文件。

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.

文档表示您必须明确选择-in仅限 client 支持,方法是将 sku = client 属性添加到< supportedRuntime /> 元素。

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.


sku属性名称区分大小写。如果缺少sku属性
,或者将其值设置为 client以外的其他值,则
运行时将假定该应用程序不是.NET Framework客户端配置文件
应用程序。

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.

但是,在.NET 4.0中,缺少有关sku属性的详细文档。在我们的测试中,即使缺少sku属性,.NET运行时也将使用.NET 4.0客户端配置文件。这是一个问题,因为它不允许使用.config文件进行动态重定向。我尝试使用 sku = full 尝试强制其仅使用完整的配置文件,但这只会导致不支持.NET 4.0运行时。

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.

有人知道使用<$时强制使用完整.NET配置文件的方法吗? c $ c>< supportedRuntime /> (或其他类似解决方案)以支持多个.NET Framework版本?

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?

<?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>


推荐答案

我的理解是这样的:

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

没有Profile = Full,但据我所知,Profile旨在限制使用较小的SKU

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

已安装的SKU列表可在

The list of installed SKUs can be found at

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs

这篇关于需要带有&lt; supportedRuntime /&gt;的.NET 4.0完整配置文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆