【问题标题】:Downgrade Asp.Net application to .Net framework 4.5.2 from 4.6.1将 Asp.Net 应用程序从 4.6.1 降级到 .Net framework 4.5.2
【发布时间】:2018-06-18 13:19:46
【问题描述】:

我想将我们当前针对 .net 框架 4.6.1 的应用程序之一降级到较低版本 4.5.2。 此应用程序有许多依赖项目和几个随 Nuget 一起安装的库。以下是我降级的步骤。

  1. 将应用程序的每个项目和所有依赖项目都转换为目标 4.5.2
  2. 运行以下命令从 Nuget 卸载并重新安装所有依赖包。

    更新包-重新安装

  3. 此步骤不是必需的,但可以肯定的是,我删除了 packages 文件夹,然后在我构建解决方案时允许 Visual Studio 再次下载它。

当我发布站点或使用 TFS 创建构建并将其部署到 IIS 并运行它时,在完成上述所有步骤后,我得到以下错误。

.NET Runtime version : 4.0.30319.36373 - This application could not be started.This application requires one of the following versions of the .NET Framework:
 .NETFramework,Version=v4.6

Do you want to install this .NET Framework version now?

【问题讨论】:

  • 请检查 web.config 中的 httpRuntime 是否有正确的 .NET 版本作为它的“targetFramework”
  • httpRuntime 和编译都有正确的目标框架集
  • 见Weird Error Upgrading ASP.NET MVC from 4 to 5。由于不同版本化组件的所有排列,Visual Studio 没有适当的“升级”或“降级”功能 - 确保所有 .csproj、Web.config 和 packages.config 同步的唯一解决方案是手动。
  • 问题最终是因为在4.6版本的web.config中添加了system.codedom编译器部分,当版本更改为4.5.2时没有更新。在我删除该部分后,它开始为我工作

标签: c# asp.net .net


【解决方案1】:

问题最终对我来说是因为在 4.6 版本的 web.config 中添加了 system.codedom 编译器部分,当版本更改为 4.5.2 时这不起作用。在我删除该部分后,它开始为我工作

<system.codedom>
<compilers>
  <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
  <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-25
    • 1970-01-01
    • 1970-01-01
    • 2013-10-13
    • 2019-12-28
    • 2022-08-12
    相关资源
    最近更新 更多