It seems there is suddenly something out of sync with asp.net core packages.
It looks like Microsoft.AspNetCore.App 2.1.1 was released 16 hours ago on nuget.org but
I had the same issue. Another option is, in NuGet Package Manager, rollback Microsoft.AspNetCore.All, Microsoft.AspNetCore.Rewrite, and Microsoft.NETCore.App to versions 2.1.0.
The wildcard version number package references is weird to me. That doesn't happen by default, so either you or one of your team members did that. I don't know if that's the source of at least some of your issues or not, but I'd start by changing them to full version references. NuGet packages are not committed with your project, so having wildcards can lead to strange build issues, particularly in automated builds, when you're developing against one version but a different version is restored later. If you want to upgrade a package, that should be an explicit choice, so you can then verify that all your code still functions as it should post-upgrade.
Also worth noting, since 2.1, code generation has been rolled in, so you should not be explicitly referencing any CodeGen packages.
As far as solving the current issue goes. You may be having some issues with your package cache. In Visual Studio, go to Tools > NuGet Package Manager > Package Management Settings, and then click the "Clear All NuGet Cache(s)" button.
That should prompt a redownload of all your projects NuGet packages, and may be enough to solve the issue. If not, I'd recommend cleaning all your projects and then going into the directory for each and manually deleting both the bin
and obj
directories. Then, rebuild your solution.
The 2.1.1 (preview) SDK is available on their GitHub.
You can download directly here:
https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/20180605-09/final/assets/Sdk/2.1.301-preview-008906/dotnet-sdk-2.1.301-win-x64.exe
See:
https://github.com/dotnet/versions/tree/7a833ffffdfddc27f2074b755b94234a25b9757637/build-info/dotnet/product/cli/release/2.1
We are still waiting on the official SDK...
Edit:
If you are having trouble building, add the following to your .csproj
<PropertyGroup>
<TargetLatestAspNetCoreRuntimePatch>true</TargetLatestAspNetCoreRuntimePatch>
</PropertyGroup>
Update:
Official 2.1.1 SDK now released: https://www.microsoft.com/net/download/thank-you/dotnet-sdk-2.1.301-windows-x64-installer
Installing 2.1.301 (https://github.com/dotnet/core/blob/master/release-notes/download-archives/2.1.1-download.md) fixed this issue for me.
Your problem is this line of your csproj
:
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.*" />
The *
is saying to pick the latest 2.1 version of that Nuget package. For many packages this would be perfectly fine. However, v2.1.1 of that package requires a matching v2.1.1 SDK to also be installed. As of right now it it not available (it's currently blocked).
However, if you read the Migrate from ASP.NET Core 2.0 to 2.1 docs, you will see this:
Replace the version specified "Microsoft.AspNetCore.All" package reference with the versionless "Microsoft.AspNetCore.App" package reference.
The version is now inferred by the version of the SDK you are targetting. This means your csproj
should now contain this:
<PackageReference Include="Microsoft.AspNetCore.App" />
In addition to other suggestions, I needed to up the Microsoft.NetCore.App to 2.1.1. Since I couldn't do it via the UI, adding the following to the .csproj worked.
<code>
<PackageReference Include="Microsoft.NetCore.App" Version="2.1.1" />
</code>