• <i id='qzni4'><tr id='qzni4'><dt id='qzni4'><q id='qzni4'><span id='qzni4'><b id='qzni4'><form id='qzni4'><ins id='qzni4'></ins><ul id='qzni4'></ul><sub id='qzni4'></sub></form><legend id='qzni4'></legend><bdo id='qzni4'><pre id='qzni4'><center id='qzni4'></center></pre></bdo></b><th id='qzni4'></th></span></q></dt></tr></i><div id='qzni4'><tfoot id='qzni4'></tfoot><dl id='qzni4'><fieldset id='qzni4'></fieldset></dl></div>

      <legend id='qzni4'><style id='qzni4'><dir id='qzni4'><q id='qzni4'></q></dir></style></legend>

        <bdo id='qzni4'></bdo><ul id='qzni4'></ul>

      <small id='qzni4'></small><noframes id='qzni4'>

      <tfoot id='qzni4'></tfoot>

        从 ASP.NET 5 Beta 4 升级到 Beta 5 时出错

        时间:2023-07-11
        <tfoot id='53TJD'></tfoot>
          <tbody id='53TJD'></tbody>
        • <bdo id='53TJD'></bdo><ul id='53TJD'></ul>
            • <i id='53TJD'><tr id='53TJD'><dt id='53TJD'><q id='53TJD'><span id='53TJD'><b id='53TJD'><form id='53TJD'><ins id='53TJD'></ins><ul id='53TJD'></ul><sub id='53TJD'></sub></form><legend id='53TJD'></legend><bdo id='53TJD'><pre id='53TJD'><center id='53TJD'></center></pre></bdo></b><th id='53TJD'></th></span></q></dt></tr></i><div id='53TJD'><tfoot id='53TJD'></tfoot><dl id='53TJD'><fieldset id='53TJD'></fieldset></dl></div>

              <small id='53TJD'></small><noframes id='53TJD'>

                  <legend id='53TJD'><style id='53TJD'><dir id='53TJD'><q id='53TJD'></q></dir></style></legend>
                  本文介绍了从 ASP.NET 5 Beta 4 升级到 Beta 5 时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已按照步骤 此处 从 ASP.NET 5 Beta 4 升级到 Beta 5,但在调用 application.UseBrowserLink(); 时在运行时出错;:

                  I have followed the steps here to upgrade from ASP.NET 5 Beta 4 to Beta 5 but am getting an error at runtime when calling application.UseBrowserLink();:

                  System.TypeLoadException"类型的异常发生在mscorlib.dll 但未在用户代码中处理

                  An exception of type 'System.TypeLoadException' occurred in mscorlib.dll but was not handled in user code

                  附加信息:无法加载类型程序集中的Microsoft.AspNet.Builder.IApplicationBuilder"'Microsoft.AspNet.Http,版本=1.0.0.0,文化=中性,PublicKeyToken=null'.

                  Additional information: Could not load type 'Microsoft.AspNet.Builder.IApplicationBuilder' from assembly 'Microsoft.AspNet.Http, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

                  这些是我遵循的步骤:

                  1. 已经安装了 VS 2015 RC.
                  2. 从 PowerShell 运行:$env:DNX_FEED="https://www.nuget.org/api/v2"
                  3. 从 PowerShell 运行:dnvm 升级
                  4. 添加了一个 Global.json 文件(我还没有).当我添加它时,它已经提到了 Beta 5:

                  1. Had VS 2015 RC already installed.
                  2. From PowerShell run: $env:DNX_FEED="https://www.nuget.org/api/v2"
                  3. From PowerShell run: dnvm upgrade
                  4. Added a Global.json file (I did not already have one). When I added it, it referred to Beta 5 already:

                  {
                      "projects": [ "Source", "Tests" ],
                      "sdk": {
                          "version": "1.0.0-beta5-12103"
                      }
                  }
                  

                • 将 project.json 中的所有包更新到 Beta 5.您可以看到我的 project.lock.json 文件的完整版本 这里.

                  {
                    "dependencies": {
                      "Boilerplate.Web.Mvc6": "1.0.2",
                      "Microsoft.AspNet.Diagnostics": "1.0.0-beta5",
                      "Microsoft.AspNet.Mvc": "6.0.0-beta5",
                      "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta5",
                      "Microsoft.AspNet.Mvc.Xml": "6.0.0-beta5",
                      "Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
                      "Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
                      "Microsoft.AspNet.StaticFiles": "1.0.0-beta5",
                      "Microsoft.AspNet.Tooling.Razor": "1.0.0-beta5",
                      "Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta5",
                      "Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-beta5",
                      "Microsoft.Framework.Configuration.Json": "1.0.0-beta5",
                      "Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta5",
                      "Microsoft.Framework.Logging": "1.0.0-beta5",
                      "Microsoft.Framework.Logging.Console": "1.0.0-beta5",
                      "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta5",
                      "Newtonsoft.Json": "6.0.6",
                      "System.Runtime": "4.0.20-beta-23019"
                    }
                    "frameworks": {
                        "dnx451": {
                          "frameworkAssemblies": {
                            "System.Net.Http": "4.0.0.0",
                            "System.ServiceModel": "4.0.0.0"
                          }
                        },
                        "dnxcore50": {
                          "dependencies": {
                            "System.Net.Http": "4.0.0-beta-23019"
                          }
                        }
                      }
                  }
                  

                • 然后说明继续说您应该运行以下命令,但我相信 VS 2015 RC 会为您执行此操作 dnu restore 然后 dnu build.
                • 更新

                  这似乎是浏览器链接的问题,注释掉该行可以使网站正常工作.可能坏了?需要寻找 aspnet GitHub 问题.

                  It seems to be a problem with browser link, commenting the line out allows the site to work. It may be broken? Need to hunt around the aspnet GitHub issues.

                  推荐答案

                  为了帮助您从 beta4 迁移到 beta5,这些是我根据研究/发现采取的以下步骤.

                  In order to help you migrate from beta4 to beta5, these are the following steps it took me, based on the research/findings.

                  • PowerShell 运行:$env:DNX_FEED="https://www.nuget.org/api/v2"
                  • PowerShell 运行:dnvm install 1.0.0-beta5
                  • PowerShell 运行:dnvm 使用 1.0.0-beta5 -p(不确定是否需要,但我必须这样做)
                  • 打开 global.json 并将 sdk 更新为 1.0.0-beta5 应该如下所示:

                  • Open global.json and update sdk to 1.0.0-beta5 should look like this:

                  {
                      "projects": [ "src", "test" ],
                      "sdk": {
                          "version": "1.0.0-beta5"
                      }
                  }
                  

                • 打开project.json:

                • Open project.json:

                  • 将依赖项版本从 beta4 更新到 beta5
                  • 从以下位置更改配置依赖项:

                  "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4"
                  

                  "Microsoft.Framework.Configuration": "1.0.0-beta5",
                  "Microsoft.Framework.Configuration.Json": "1.0.0-beta5"
                  

                • 删除 Microsoft.VisualStudio.Web.BrowserLink.Loader
                • _GlobalImport.cshtml 重命名为 _ViewImports.cshtml
                • Remove Microsoft.VisualStudio.Web.BrowserLink.Loader
                • Rename _GlobalImport.cshtml to _ViewImports.cshtml
                  • 更改配置的重大更改

                  • Change Configuration breaking changes

                  • 将命名空间从 using Microsoft.Framework.ConfigurationModel; 更改为 using Microsoft.Framework.Configuration;

                  Configuration.GetSubKey 更改为 Configuration.GetConfigurationSection

                  将 CTOR 更改为:

                  Change CTOR to:

                  public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
                  {           
                      // Setup configuration sources.
                      var configBuilder = new ConfigurationBuilder(appEnv.ApplicationBasePath)
                      .AddJsonFile("config.json")
                      .AddEnvironmentVariables();
                  
                      Configuration = configBuilder.Build();
                  }
                  

                • 删除 app.UseBrowserLink();
                  • 应用根目录
                  • 中打开 PowerShell
                  • 运行dnu restore
                  • 运行 dnu 构建
                  • 此时关闭和重新打开 VS 有时会有所帮助.

                  我自己发现升级现有项目非常困难,无法找到所需的所有步骤.希望对您有所帮助!

                  Myself found it quite difficult to upgrade an existing project, couldn't find all steps required all together. Hope it helps!

                  这篇关于从 ASP.NET 5 Beta 4 升级到 Beta 5 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何禁用 net core 2.1+/net 5 中的预编译视图进行调试? 下一篇:找不到与命令“dotnet-aspnet-codegenerator"匹配的可执行文件

                  相关文章

                  <tfoot id='lhcnN'></tfoot>
                    1. <legend id='lhcnN'><style id='lhcnN'><dir id='lhcnN'><q id='lhcnN'></q></dir></style></legend>
                      <i id='lhcnN'><tr id='lhcnN'><dt id='lhcnN'><q id='lhcnN'><span id='lhcnN'><b id='lhcnN'><form id='lhcnN'><ins id='lhcnN'></ins><ul id='lhcnN'></ul><sub id='lhcnN'></sub></form><legend id='lhcnN'></legend><bdo id='lhcnN'><pre id='lhcnN'><center id='lhcnN'></center></pre></bdo></b><th id='lhcnN'></th></span></q></dt></tr></i><div id='lhcnN'><tfoot id='lhcnN'></tfoot><dl id='lhcnN'><fieldset id='lhcnN'></fieldset></dl></div>

                      <small id='lhcnN'></small><noframes id='lhcnN'>

                        <bdo id='lhcnN'></bdo><ul id='lhcnN'></ul>