ardalis

Steve Smith, software craftsman

Connect with me:

  • Blog
  • Training
  • Mentoring
  • Dev Tips
  • Architecture eBook
  • Tools Used
  • About
ASP.NET 5 Migration to RC1 Notes

Steve Smith 16 Dec 2015 2 Comments

ASP.NET 5 Migration to RC1 Notes

I’ve been migrating a number of articles from docs.asp.net to RC1 from beta8 (and earlier) and these are some of my notes. You may also find the following links helpful:

  • Eric Anderson Migration from Beta 8 to RC1
  • DamienBod Updating to Beta8 from Older Beta Versions
  • Shawn Wildermuth Upgrading ASP.NET 5 Beta 8 to RC1
  • View All Breaking Changes from Beta8 to RC1 on GitHub

Get Latest Version

The first step is to make sure you have the latest bits installed yourself, including the tooling updates (for Visual Studio). The easiest way to do this is to go to get.asp.net.

I’m not going to go through all of the changes that others have previously covered. I just want to point out some errors I ran into and how I resolved them. See Shawn’s post for a more complete walkthrough of changes that are needed to pretty much all beta8 projects to migrate them to RC1.

Error: Could not load type ‘Microsoft.Dnx.Host.Clr.EntryPoint’ from assembly ‘Microsoft.Dns.Host.Clr’

This error can occur because you don’t have a main method in your Startup.cs. This requirement was added in RC1. You can simply copy this into your Startup.cs. Alternately, create a new web project an copy the method from its startup.cs file into your project.

C#
1
public static void Main(string[] args) => WebApplication.Run<Startup>(args);

Error: app.UseDatabaseErrorPage(DatabaseErrorPageOptions.Showall)

This method no longer takes a parameter. Replace it with app.UseDatabaseErrorPage().

Entity Framework Updates

EF updated a bunch of the names of its methods for ModelBuilder. Mostly this involved adding “Has” to them.

Change Annotation to HasAnnotation

Change Index to HasIndex

Change ForeignKey to HasForeignKey

I also ran into errors with a model class that didn’t have a setter, which worked in the previous version. I had to make the following change:

1
2
3
4
5
// beta 8 version
public string Name { get; } = String.Empty;
 
// RC1 version
public string Name {get; private set; } = String.Empty;

 

MVC Updates

If you’re using the default starter web template, there were many changes to AccountController and ManageController. You’re probably best off just copying these in from a new project built using the RC1 templates. You’ll also need RemoveLoginViewModel class from the ViewModels/Manage folder.

IIS Problems

I was able to run the project using Kestrel, but not IIS, until I updated the web.config file located in wwwroot to the following:

1
2
3
4
5
6
7
8
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform arguments="%DNX_ARGS%" processPath="%DNX_PATH%" startupTimeLimit="3600" stdoutLogEnabled="false"/>
  </system.webServer>
</configuration>

That’s all I have for now – if you have questions or other suggestions, please add them to the comments below. Thanks!

Filed Under: Software Development Tagged With: asp.net core

About Steve Smith

Steve is an experienced software architect and trainer, focusing currently on ASP.NET Core and Domain-Driven Design. His courses on Pluralsight help developers write better, more maintainable code. He is available for application assessments and team mentoring engagements.

Online Training

  • ASP.NET Core Quick Start
  • Domain-Driven Design Fundamentals
  • Refactoring Fundamentals
  • Kanban Fundamentals
  • SOLID Principles of OO Design
  • Pair Programming

About Me

Steve is an experienced software architect and trainer focused on improving team skills with DDD and ASP.NET Core. His courses on Pluralsight and DevIQ help developers write better, more maintainable code. He is available for application assessments and team mentoring engagements.

Sign up to receive a free developer tip from Steve in your inbox every Wednesday.

Free Architecture eBook

Architecting Modern Web Applications with ASP.NET Core and Microsoft Azure
Get the Book!

Recent Articles

  • Using Grep to Find Strings in Markdown .md Files on Windows
  • Domain-Driven Design with ASP.NET Core Workshop
  • Moving from Controllers and Actions to Endpoints with MediatR
  • Sketch Themes for Prototypes
  • Be Humble and Kind

Popular Articles

  • Force Nuget to Reinstall Packages without Updating 1,081 views
  • The More You Know The More You Realize You Don't Know 680 views
  • Easily Add Images to GitHub 559 views
  • Using MediatR in ASPNET Core Apps 478 views
  • SQL Server Error User Group or Role Already Exists in the Current Database 462 views

Categories

  • Iraq (118)
  • Personal (6)
  • Productivity (74)
  • Security (5)
  • Software Development (435)
  • Uncategorized (890)

Recent Tweets by @ardalis

Tweets by @ardalis

Copyright © 2019 · Streamline Pro Theme on Genesis Framework · WordPress · Log in