Migration from ASP.NET Beta 4 to Beta 5

ASP.NET beta 5 was released on June 30th. See this blog post from Microsoft for details. I also recommend this video of the ASP.NET community standup from the day of the beta 5 release it has a lot of great information on the release and way forward for ASP.NET 5. This post is going to cover a migration of my contacts application from beta 4 to beta 5.

To start upgrade dnvm by opening a command prompt and running the following command.

After that is complete use dnvm to get beta 5 by running the following.

The rest of the migration was performed from Visual Studio. Next up is an update to global.json to change the version from beta4 to beta5.

In project.json the dependencies section needs values beta4 updated to beta5.

One big thing here to note is that Microsoft.Framework.ConfigurationModel and all its children have been renamed to Microsof.Framework.Configuration. For example Microsoft.Framework.ConfigurationModel.Json is now Microsoft.Framework.Configuration.Json.

In the Views folder _GlobalImport.cshtml needs to be renamed to _ViewImports.cshtml.

Entity framework migrations had some issues as well, but I decided to just delete the existing migrations and start from scratch since the database contains a minimal amount of data.

The last set of changes are in Startup.cs. First up is a using change for the ConfigurationModel to Configuration rename.

Next up is the Startup function. Here a builder has been added which is then used to create the actual configuration. Also note the added function parameter for IApplicationEnviroment which is used to get the application path for use by the configuration builder.

In the ConfigureServices function Configuration.GetSubKey has been replaced by Configuration.GetConfigurationSection.

The last change was to remove app.UseBrowserLink. I am not thrilled with having to remove the use of browser link but it is throwing a System.TypeLoadException. I am going to keep looking for this issue but with UseBrowserLink commented out everything else works fine. If anyone else has this issue and finds a fix please leave a comment on how it was fixed.

If your application is still having trouble check out this page which contains a list of breaking changes from beta 4 to beta 5.

2 thoughts on “Migration from ASP.NET Beta 4 to Beta 5”

  1. I’m using the Microsoft.AspNet.Identity.EntityFramework v3.0.0-beta4, however, I’m not getting a solution to customize the AspNetUserClaims table.

    I can add attributes to AspNetUser and AspNetRoles tables, as in my code below.

    public class ApplicationUser : IdentityUser
    {
    public string Name { get; set; }
    }

    public class ApplicationRole : IdentityRole
    {
    public int AppId { get; set; }
    public string Description { get; set; }
    // Navigation Properties
    public virtual App App { get; set; }
    }

    public class ApplicationDbContext : IdentityDbContext
    {
    private static bool _created;
    public virtual DbSet App { get; set; }
    public ApplicationDbContext()
    {
    if (!_created)
    {
    Database.AsRelational().ApplyMigrations();
    _created = true;
    }
    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
    base.OnModelCreating(builder);
    }
    }

    1. Marcos did you create a new migration from your changes? Based on the code you posted if you had a migration it should have been applied when an instance of ApplicationDbConext was created.

      This covers adding a new migration if that is the step you are missing.

Leave a Reply

Your email address will not be published. Required fields are marked *