Error Upgrading from ASP.NET 5 Beta 4 to Beta 5

前端 未结 6 1911
一生所求
一生所求 2020-12-14 23:03

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();:

6条回答
  •  無奈伤痛
    2020-12-14 23:43

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

    Environment

    • PowerShell run: $env:DNX_FEED="https://www.nuget.org/api/v2"
    • PowerShell run: dnvm install 1.0.0-beta5
    • PowerShell run: dnvm use 1.0.0-beta5 -p (not sure if its needed however i had to)

    Project

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

      {
          "projects": [ "src", "test" ],
          "sdk": {
              "version": "1.0.0-beta5"
          }
      }
      
    • Open project.json:

      • Updated dependencies versions from beta4 to beta5
      • Change Configuration dependency from:

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

        to

        "Microsoft.Framework.Configuration": "1.0.0-beta5",
        "Microsoft.Framework.Configuration.Json": "1.0.0-beta5"
        
      • Remove Microsoft.VisualStudio.Web.BrowserLink.Loader
      • Rename _GlobalImport.cshtml to _ViewImports.cshtml

    Startup.cs changes

    • Change Configuration breaking changes

      • Change namespace from using Microsoft.Framework.ConfigurationModel; to using Microsoft.Framework.Configuration;

      • Change Configuration.GetSubKey to Configuration.GetConfigurationSection

      • 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();
        }
        
      • Remove app.UseBrowserLink();

    Project DNU CMDs

    • Open PowerShell within app root
    • Run dnu restore
    • Run dnu build
    • Closing and reopening VS at this point helps sometimes.

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

提交回复
热议问题