So, I have a happily working ASP.NET Core 1.0 app targeting net461 framework.
Today I tried to upgrade it to the new ASP.NET Core 1.1 (according to the instructions on this page all you need to do is a Nuget package upgrade)
This resulted in the following slew of errors:
error: Unable to resolve 'Microsoft.AspNetCore.Diagnostics.Abstractions (>= 1.1.0)' for '.NETFramework,Version=v4.6.1'.
error: Unable to resolve 'Microsoft.AspNetCore.Hosting.Abstractions (>= 1.1.0)' for '.NETFramework,Version=v4.6.1'.
error: Unable to resolve 'Microsoft.AspNetCore.Http.Extensions (>= 1.1.0)' for '.NETFramework,Version=v4.6.1'.
error: Unable to resolve 'Microsoft.AspNetCore.WebUtilities (>= 1.1.0)' for '.NETFramework,Version=v4.6.1'.
error: Unable to resolve 'Microsoft.Extensions.FileProviders.Physical (>= 1.1.0)' for '.NETFramework,Version=v4.6.1'.
error: Unable to resolve 'Microsoft.Extensions.Logging.Abstractions (>= 1.1.0)' for '.NETFramework,Version=v4.6.1'.
error: Unable to resolve 'Microsoft.Extensions.Options (>= 1.1.0)' for '.NETFramework,Version=v4.6.1'.
error: Unable to resolve 'System.Diagnostics.DiagnosticSource (>= 4.3.0)' for '.NETFramework,Version=v4.6.1'.
error: Unable to resolve 'System.Reflection.Metadata (>= 1.4.1)' for '.NETFramework,Version=v4.6.1'.
error: Unable to resolve 'Microsoft.AspNetCore.Mvc.ApiExplorer (>= 1.1.0)' for '.NETFramework,Version=v4.6.1'.
error: Unable to resolve 'Microsoft.AspNetCore.Mvc.Cors (>= 1.1.0)' for '.NETFramework,Version=v4.6.1'.
...
what am I missing here? Shouldn't this just work?
For reference, here are the relevant sections of the project.json (before running the Nuget upgrade):
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.AspNet.WebApi.Client": "5.2.3"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"net461": {
"imports": [
]
}
}
EDIT: after running the Nuget upgrade, the dependencies section was changed to this by Visual Studio:
"dependencies": {
"Microsoft.AspNet.WebApi.Client": "5.2.3",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0"
},
I finally figured it out, in case anyone else has the same problem.
There were three steps to make it work:
For some reason, the standard "Microsoft and .NET" Nuget feed was not including these packages.. I had to open the Nuget Settings and tick the "nuget.org" feed as well. Having done that it was able to restore the v1.1 packages
The blog post that I was referencing didn't mention that you need to open your global.json file and change the SDK Version to "1.0.0-preview2-1-003177" (for some reason, v1.1 still has an SDK called v1.0.0 -- any ideas what's going on there?!?)
Having done those two things, trying to run the app produced a 500 error, but after enabling stdoutLogEnabled in web.config you can see the exception is:
System.IO.FileLoadException: Could not load file or assembly 'System.Collections.Immutable, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
To solve this, you need to delete your application's bin folder and then rebuild (for some reason "Rebuild Solution" isn't enough). When you deploy to Production, presumably you'll also need to delete the bin folder there or you might get the same problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With