Updating to ASP NET 5 beta5 breaks everything
Asked Answered
M

2

5

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
Myranda answered 3/7, 2015 at 9:10 Comment(2)
Can you share the dnvm list command output ?Flanch
try to uninstall 1.0.0-beta5-12103 (simply remove the folder) and run dnvm use default and run dnu restore. the commands you tryed was under beta4 as the * saysFlanch
W
8

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

Wassail answered 3/7, 2015 at 14:5 Comment(9)
Using "beta5-*" instead of just "beta5" did the trick. ThanksDebbi
+1 Wish I saw this post yesterday! Also see: github.com/aspnet/Announcements/issues/27 and github.com/aspnet/Announcements/issues/33 which were issues for me but in fact just look here: github.com/aspnet/Announcements/issuesAlmita
That -* syntax is called "floating the versions." David Fowl writes about it here davidfowl.com/diagnosing-dependency-issues-with-asp-net-5Wassail
@davidfowl Thanks for the edits. I appreciate them and yet don't understand. Why remove the specific build from global.json? Why remove the floating build from project.json? I'm feel particularly confused because the edits were only to the code samples but not to the matching instructions. The result seems to be that the instructions no longer match their examples. What am I missing? In global.json, are we not supposed to point to a specific build? In project.json, are we not supposed to use a floating build version (as in the example) or are we to use one (as in the instructions?)Wassail
1.0.0-beta5 came out. That's the last version of beta5. There's no need to specify build numbers or floating versions. It's meaningless.Distich
@Distich That makes sense. Thank you. Will using the floating build numbers still be relevant for beta6 until MS releases it? I suspect so but would like to confirm.Wassail
Yep! You got it! As an aside, the reason you want to remove the -* when the actual beta comes out is because we do some weirdness when we deploy to NuGet.org to make it easy to install official versions. When we publish to nuget.org, we remove build numbers. This means that 1.0.0-beta5-{somebuild} > 1.0.0-beta5, this isn't great but it makes it easier to find the right version of the package.Distich
@Distich Should we delete the specific build versions once MS releases a beta to NuGet.org. I.e. should the original poster delete \.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta5-12103 now that beta5 is out?Wassail
Nah that doesn't really matter so much. It would reduce noise but it's harmless for the most part.Distich
S
1

@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'.
Sidney answered 7/7, 2015 at 16:11 Comment(1)
Not only renamed, but their method of use was changed around a bit too github.com/aspnet/Announcements/issues/25Contemplate

© 2022 - 2024 — McMap. All rights reserved.