ASP.NET CORE RC2 Package Restoration Woes

Working with pre-release tools is always an adventure, and I'm sure that anyone that has followed ASP.NET Core (or any of its other names) can attest to that.

With a few different applications in some form of production, I've been extremely happy with the changes .NET Core introduced to the ecosystem. However, after installing latest ASP.NET Core Tools Update to Visual Studio, things got rather iffy.

I hadn't realized that this update would automatically make the assumption that I wanted to jump to RC2 and frankly, I wasn't ready.

Now, it's working; Now, it isn't.


This abbreviated list of errors are just a few that manifested themselves after installing the update. The most noticeable being that dnx had changed to dotnet, which after running a quick dotnet restore command, I assumed would fix it. Nope!

There were a bevy of changes brought about in RC2 and I honestly didn't really plan on migrating my existing stable applications there at all. I figured that waiting around until RTM or the official release would be perfectly fine.

And now, I get to play detective to see exactly where things went wrong.

What was really wrong?

Since some of the applications in question have been continuously upgraded since as early as beta-2, quite a large number of things have changed. Different naming conventions, constant API changes, and updates to middleware, etc.

I decided that the easiest way to figure out what was wrong would be to simply spin up a new RC2 project and compare my existing project to the default one.

It turns out that somewhere along the line, a global.json configuration file was introduced at the solution level. If you don't have a global.json file within your ASP.NET Core project, you need to create one that might look like this.

  1. {  
  2.     "projects": [ "src""test" ],  
  3.     "sdk": {  
  4.       "version""1.0.0-preview1-002702"  
  5.     }  
  6. }   

After adding this file and running dotnet restore, you should see that your packages get picked up as expected and you should be able to continue using your RC1 project.

Note

If you want to stay on RC1, you'll need to explicitly define that, by setting the version attribute to 1.0.0-rc1-update1.

  1. "sdk": {  
  2.       "version""1.0.0-rc1-update1"  
  3. }  

Up Next
    Ebook Download
    View all
    Learn
    View all