Upgrading your ASP.NET 5 project from Beta 7 to Beta 8

Microsoft just released ASP.NET 5 and Entity Framework Beta 8. There were some breaking changes which require some changes in existing code.
All changes can be found here: Announcing Availability of ASP.NET 5 Beta8

As with every upgrade you should change the -beta7 to -beta8 in the global.json and in all package.json files.
Below I address the things I found which need to be corrected:

Package.json

Remove these dependencies:

  • "Microsoft.AspNet.Server.IIS": "1.0.0-beta7"
  • "Microsoft.AspNet.Server.WebListener": "1.0.0-beta7"
and replace them with:
  • "Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8"
  • "Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8"
Finally add this one:
  • "Microsoft.Framework.Logging.Debug" : "1.0.0-beta8"
Now change the web command
  • "web": "Microsoft.AspNet.Hosting --config hosting.ini"
to
  • "web": "Microsoft.AspNet.Server.Kestrel"
You can delete the hosting.ini since it isn't used anymore.

Controllers

The property Context was renamed to HttpContext.

web.config

Remove this part: and add this instead:

Startup.cs

And in method Configure

Mocking DbSet

If you're mocking DbSet's AddRange method, you have to specify the optional parameter, since one was added in EF Beta8:

That were all problems I had in my code.

Comments

Popular posts from this blog

Debugging Lua scripts in VS Code using MoonSharp

Testing the response body of middleware in ASP.NET Core

Make ‘dotnet ef‘ work with EF Core 2.0