AspNetCore.Mvc.Core Version Mismatch

<PackageReference Include="Microsoft.AspNetCore.App" />

I had the same issue, after add this line to unit test project, it start pick right version of Microsoft.AspNetCore.App.


Update

The issue noted below has been fixed & you should be able to benefit from implicit package versioning and reference like below without providing the version number of the package.

<PackageReference Include="Microsoft.AspNetCore.App" />

Original Answer

This issue is because of the Implicit Versioning that was introduced for Microsoft.AspNetCore.App metapackage. With implicit versioning the sdk decides the version & it resolved it as 2.1.1

However, it was resolving to version 2.1 for the nunit test project. Specifying the version number for the nunit project like <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1"/> and performing dotnet restore helped resolve this issue.

There is a ticket for this issue in github and this behavior around implicit versioning could change in future - https://github.com/aspnet/AspNetCore.Docs/issues/6430 & https://github.com/dotnet/core/blob/master/release-notes/1.0/sdk/1.0-rc3-implicit-package-refs.md