Search code examples
asp.net-core.net-coreasp.net-core-mvc-2.1

How do I resolve version conflicts in aspnet core 2.1? (2.1.1 >= 2.1.0-rc1-final)


Trying to add Microsoft.VisualStudio.Web.BrowserLink 2.1.1 as a nuget package on a very stock File -> New -> Project .net core 2.1 project.

Version conflict detected for Microsoft.AspNetCore.Hosting.Abstractions.    Reference the package directly from the project to resolve this issue. 
EngineeringWeb (>= 1.0.0) -> Microsoft.VisualStudio.Web.BrowserLink (>= 2.1.1) -> Microsoft.AspNetCore.Hosting.Abstractions (>= 2.1.1) 
EngineeringWeb (>= 1.0.0) -> Microsoft.AspNetCore.App (>= 2.1.0-rc1-final) -> Microsoft.AspNetCore.Hosting.Abstractions (>= 2.1.0-rc1-final).

I recall doing things in csproj files in the past to redirect versions. I was hoping to avoid that with in core.

The .csproj file:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Features\" />
    <Folder Include="Features\Registration\" />
  </ItemGroup>
  <ItemGroup>
    <Compile Remove="Controllers\HomeController.cs" />
  </ItemGroup>
  <ProjectExtensions>
    <MonoDevelop>
      <Properties>
        <Policies>
          <VersionControlPolicy>
            <CommitMessageStyle LastFilePostfix=":&#xA;  " LineAlign="0" IncludeDirectoryPaths="True" />
          </VersionControlPolicy>
        </Policies>
      </Properties>
    </MonoDevelop>
  </ProjectExtensions>
</Project>

Solution

  • The shared framework package Microsoft.AspNetCore.App should always be used without a version number, like this:

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

    That way, it will be resolved automatically by the runtime, which ships the packages and its dependencies as part of .NET Core, and will automatically roll forward patch releases. So in order to upgrade to 2.1.1, you should just upgrade your local .NET Core SDK, and the .NET Core runtime on the server you deploy to.

    As for your problem, if you look at the output, you will see the following:

    Microsoft.AspNetCore.App (>= 2.1.0-rc1-final) 
    

    The version there is 2.1.0-rc1-final. This suggest that you have not updated your local SDK for neither 2.1.0 RTM nor to 2.1.1. You can download the current SDK v2.1.301 over here. All downloads, including the runtime installers for your server can be found over here.