The project was restored using Microsoft.NETCore.App version 2.1.0, but with current settings, version 2.1.0-rtm-26515-03 would be used instead
The project was restored using Microsoft.NETCore.App version 2.1.0, but with current settings, version 2.1.0-rtm-26515-03 would be used instead
This is a known issue at this moment. To resolve this issue, you can try following workarounds:
Add
TargetLatestRuntimePatch
attribute in.csproj
file:<PropertyGroup> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> </PropertyGroup>
Or
set
RuntimeFrameworkVersion
andRuntimeIdentifier
in.csproj
file:<PropertyGroup> <RuntimeFrameworkVersion>2.1.1</RuntimeFrameworkVersion> <PlatformTarget>AnyCPU</PlatformTarget> <RuntimeIdentifier>win-x64</RuntimeIdentifier> </PropertyGroup>
If above workaround not work for you, please check more workarounds on the investigation issue.
See Self-contained deployment runtime roll forward for more information.
I wanted to publish an ASP.NET Core 2.1 Console app and got errors about colliding versions 2.1.0 and 2.1.6.
Since I had lot of projects in my solution (and VS did not give me any hints on which projects were problematic, I created a file Directory.Build.props
with the following contents and placed it in the directory where my .sln
file was
<Project>
<PropertyGroup>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<GenerateFullPaths>true</GenerateFullPaths>
<LangVersion>latest</LangVersion>
</PropertyGroup>
</Project>
The important thing here is the <TargetLatestRuntimePatch>
entry.
This way, all the projects use the same settings and I did not have to synchronize those manually.
Doc of Directory.Build.props is here https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2017
I have solved the issue as follows:
First, add following code into .csproj file
<PropertyGroup>
<RuntimeFrameworkVersion>2.1.1</RuntimeFrameworkVersion>
<PlatformTarget>AnyCPU</PlatformTarget>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
Next, check Microsoft.AspNetCore.App version is 2.1.1. if not please install this version.
Lastly, restore your package with 2.1.1 version. To restore run following code from package manager console
Install-Package Microsoft.NETCore.App -Version 2.1.1