locked
tooling issue - version conflict detected for microsoft.extensions.configuration RRS feed

  • Question

  • User379720387 posted

    "Install/reference microsoft.extensions.configuration 3.1.4 directly to project UserNameAPI to resolve this issue"

    Points to file UserNameAPI.csproj

    <Project Sdk="Microsoft.NET.Sdk.Web">
    
      <PropertyGroup>
        <TargetFramework>netcoreapp2.2</TargetFramework>
        <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="Microsoft.AspNetCore.App" />
        <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
        <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.4" />
        <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
        <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4">
          <PrivateAssets>all</PrivateAssets>
          <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>
        <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.4" />
      </ItemGroup>
    
      <ItemGroup>
        <ProjectReference Include="..\UserNameLibrary\UserNameLibrary.csproj" />
      </ItemGroup>
    
    </Project>
    

    When I do that through the package manager it fails:

    Severity	Code	Description	Project	File	Line	Suppression State
    Error		Package restore failed. Rolling back package changes for 'UserNameAPI'.				
    Error	NU1107	Version conflict detected for Microsoft.Extensions.Configuration. Install/reference Microsoft.Extensions.Configuration 3.1.4 directly to project UserNameAPI to resolve this issue. 
     UserNameAPI -> UserNameLibrary -> Microsoft.Extensions.Http 3.1.4 -> Microsoft.Extensions.Logging 3.1.4 -> Microsoft.Extensions.Configuration.Binder 3.1.4 -> Microsoft.Extensions.Configuration (>= 3.1.4) 
     UserNameAPI -> Microsoft.AspNetCore.App 2.2.0 -> Microsoft.Extensions.Configuration (>= 2.2.0 && < 2.3.0).	UserNameAPI	C:\Users\Robert\source\Repos\SchoolNew\UserNameAPI\UserNameAPI.csproj	1	
    Error	NU1107	Version conflict detected for Microsoft.Extensions.Configuration. Install/reference Microsoft.Extensions.Configuration 3.1.4 directly to project UserNameAPI to resolve this issue. 
     UserNameAPI -> UserNameLibrary -> Microsoft.Extensions.Http 3.1.4 -> Microsoft.Extensions.Logging 3.1.4 -> Microsoft.Extensions.Configuration.Binder 3.1.4 -> Microsoft.Extensions.Configuration (>= 3.1.4) 
     UserNameAPI -> Microsoft.AspNetCore.App 2.2.0 -> Microsoft.Extensions.Configuration (>= 2.2.0 && < 2.3.0).	UserNameAPI	C:\Users\Robert\source\Repos\SchoolNew\UserNameAPI\UserNameAPI.csproj	1	
    

    How to proceed from here?

    Tuesday, June 2, 2020 1:45 PM

Answers

  • User379720387 posted

    Ended up fixing this by adding <PackageReference> to my csproj file, one by one, for each of the packages VS2019 said to add:

        <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" />
        <PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Http" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Options" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Primitives" Version="3.1.4" />

    After these were added it started working.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 3, 2020 2:02 AM

All replies

  • User-474980206 posted

    most likely the usernamelibrary is a .net 3.1 project and not compatible because it requires 3.1 nuget packages. As core 2,2 is no longer supported, you should upgrade to 3.1.

    Tuesday, June 2, 2020 2:35 PM
  • User379720387 posted

    I am educating myself on Blazor and have gone through this tutorial.

    There are 3 components involved:

    a class library

    a webAPI (based on core 2.2)

    and a Blazor WASM

    With the assistance here, I was able to get it working.

    Now I am redoing the same project but this time with my own table of usernames.

    All the dependencies are the same for each of the 3 components, between the two functionalities, except for Microsoft.VisualStuidio.Web.CodeGeneration.Design.

    In the working functionality it is version 3.1.2 while in the none working functionality it is 2.2.4

    I am hesitant to upgrade Core because I know there will be many breaking changes. Rather figure out why I cannot duplicate this.

    Tuesday, June 2, 2020 5:35 PM
  • User-474980206 posted

    As blazor hosting requires 3.1, you will need to build a standalone blazor deployment. Then copy this deployment to the static file support of your webapi project.

    Tuesday, June 2, 2020 5:57 PM
  • User379720387 posted

    This is an application that will be local.

    I would like to understand the rest of what you said, for future reference. No idea what you are talking about.

    Tuesday, June 2, 2020 7:18 PM
  • User-474980206 posted

    its pretty simple. core 2.2 does not support blazor projects. you have a couple options

    1) two websites. one asp.net core 3.1 website to host the blazor project and download to client. a second asp.net core 2.2 website that is the webapi for the blazor code to call. as they are different sites CORS is required.

    2) the blazor project should be used to build a standalone deploy. you then copy the deploy to the app.net core 2.2 websites static files (wwwroot). I don't know it 2.2 allowed config a startup static file. if not, have default route just redirect to  the index.html file hosting the blazor app.

    3) simplest  - update the no longer unsupported 2.2 project  to supported 3.1 LTS

    Tuesday, June 2, 2020 9:53 PM
  • User379720387 posted

    Ended up fixing this by adding <PackageReference> to my csproj file, one by one, for each of the packages VS2019 said to add:

        <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" />
        <PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Http" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Options" Version="3.1.4" />
        <PackageReference Include="Microsoft.Extensions.Primitives" Version="3.1.4" />

    After these were added it started working.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 3, 2020 2:02 AM