Updating to ASP NET 5 beta5 breaks everything

北战南征 提交于 2019-12-12 08:13:13

问题


I followed this guide when updating to beta5 and the update process seems to have worked.

http://blogs.msdn.com/b/webdev/archive/2015/06/30/asp-net-5-beta5-now-available.aspx

To update to ASP.NET 5 Beta5 use the following steps:

  • Install the .NET Version Manager (DNVM) if you don’t already have it (it comes preinstalled with Visual Studio 2015 RC, or you can get the latest version)
  • From a command prompt set the DNX_FEED environment variable to https://www.nuget.org/api/v2
  • Run “dnvm upgrade” In your app update your global.json to point to beta5 version of the .NET Execution Environment (DNX)
  • Also your project.json to point to the beta5 package versions
  • Run “dnu restore” Run “dnu build” and migrate your code to beta5 s needed

However I'm getting build errors that says I have missing assemblies. It complains about System.Void and such is missing. It also can't find Controller from Microsoft.AspNet.MVC :/

If I revert back to beta4 then it works again.

What step am I missing?

DNVM list (this is reverted back to beta4)

Active Version           Runtime Architecture Location                      Ali
                                                                            as
------ -------           ------- ------------ --------                      ---
       1.0.0-beta4       clr     x64          C:\Users\MySelf\.dnx\runtimes
  *    1.0.0-beta4       clr     x86          C:\Users\MySelf\.dnx\runtimes
       1.0.0-beta4       coreclr x64          C:\Users\MySelf\.dnx\runtimes
       1.0.0-beta4       coreclr x86          C:\Users\MySelf\.dnx\runtimes
       1.0.0-beta5       clr     x86          C:\Users\Myself\.dnx\runtimes def
       1.0.0-beta5-12103 clr     x86          C:\Users\MySelf\.dnx\runtimes

回答1:


I just upgraded a Visual Studio 2015 ASP.MVC Web Application from beta4 to beta5 and now have it running. Here are some additions to the instructions that you followed.

Run “dnvm upgrade”

After doing that, this is what dnvm list will output.

Active Version           Runtime Architecture Location                       Alias
------ -------           ------- ------------ --------                       -----
       1.0.0-beta4       clr     x64          C:\Users\BigFont\.dnx\runtimes
       1.0.0-beta4       clr     x86          C:\Users\BigFont\.dnx\runtimes
       1.0.0-beta4       coreclr x64          C:\Users\BigFont\.dnx\runtimes
       1.0.0-beta4       coreclr x86          C:\Users\BigFont\.dnx\runtimes
  *    1.0.0-beta5       clr     x86          C:\Users\BigFont\.dnx\runtimes default
       1.0.0-beta5-12087 clr     x86          C:\Users\BigFont\.dnx\runtimes

In your app update your global.json to point to beta5

In global.json point to the specific build of beta5:

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

Also your project.json to point to the beta5 package versions

In project.json reference beta5. That will make dnu restore the most recent build (well, kinda - David Fowl describes the nuances of the "floating version" here.)

"dependencies": {
  "Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
  "Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
  "Microsoft.AspNet.StaticFiles": "1.0.0-beta5"
},

...migrate your code to beta5 as needed

Once you've stopped received errors about missing fundamental objects like System.Void, you might receive errors about breaking changes. This could take some research to solve, depending on what your code base uses. For instance, if you're using ASP.NET Identity, you'll need to change this:

SignInManager.PasswordSignInAsync(
    model.Email, model.Password, model.RememberMe, shouldLockout: false);

to this:

SignInManager.PasswordSignInAsync(
    model.Email, model.Password, model.RememberMe, lockoutOnFailure: false);

Final note re: Visual Studio

Closing and reopening the solution in Visual Studio can resolve restore/build problems after updating global.json and package.json files.

See also: ASP.NET 5 (vNext) web project: library conflict upgrading from beta4 to beta6




回答2:


@Shaun Luttin has it covered but I will mention two things:

  • Browser Link does not actually work in Beta 5. It causes a very strange error. You need to comment out app.UseBrowserlink() to get things working. Later versions have fixed this issue.
  • I also found that the packages with 'ConfigurationModel' in the name were renamed to 'Configuration'.


来源:https://stackoverflow.com/questions/31202888/updating-to-asp-net-5-beta5-breaks-everything

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!