Open Closed

dotnet run failed on authserver -> EntityFramworkCore conflict #1452


0
[email protected] created

Hi,

  • I have updated ABP suite
  • Created a new Microservice solution with MVC.
  • Clean solution
  • dotnet restore
  • dotnet build
  • Then start all applications.

All applications succeeded but the Auth-server will fail with following info. It looks a conflict with EntityFramworkCore, but how can we solve this? It seems to be a bug in the ABP framework. Please help!

Building... C:\Users\NAME\.nuget\packages\microsoft.extensions.fileproviders.embedded\5.0.7\build\netstandard2.0\Microsoft.Extensions.FileProviders.Embedded.targets(19,5): warning : GenerateEmbeddedFilesManifest was set, but no EmbeddedResource items were found that could be added to the manifest. [C:\Folder\IBP\services\administration\src\IBP.AdministrationService.Domain.Shared\IBP.AdministrationService.Domain.Shared.csproj] C:\Users\NAME\.nuget\packages\microsoft.extensions.fileproviders.embedded\5.0.7\build\netstandard2.0\Microsoft.Extensions.FileProviders.Embedded.targets(19,5): warning : GenerateEmbeddedFilesManifest was set, but no EmbeddedResource items were found that could be added to the manifest. [C:\Folder\IBP\services\saas\src\IBP.SaasService.Domain.Shared\IBP.SaasService.Domain.Shared.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: Found conflicts between different versions of "Microsoft.EntityFrameworkCore" that could not be resolved. [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: There was a conflict between "Microsoft.EntityFrameworkCore, Version=5.0.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.EntityFrameworkCore, Version=5.0.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60". [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: "Microsoft.EntityFrameworkCore, Version=5.0.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was chosen because it was primary and "Microsoft.EntityFrameworkCore, Version=5.0.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was not. [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: References which depend on "Microsoft.EntityFrameworkCore, Version=5.0.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [C:\Users\NAME\.nuget\packages\microsoft.entityframeworkcore\5.0.6\lib\netstandard2.1\Microsoft.EntityFrameworkCore.dll]. [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Users\NAME\.nuget\packages\microsoft.entityframeworkcore\5.0.6\lib\netstandard2.1\Microsoft.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: Project file item includes which caused reference "C:\Users\NAME\.nuget\packages\microsoft.entityframeworkcore\5.0.6\lib\netstandard2.1\Microsoft.EntityFrameworkCore.dll". [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Users\NAME\.nuget\packages\microsoft.entityframeworkcore\5.0.6\lib\netstandard2.1\Microsoft.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: References which depend on "Microsoft.EntityFrameworkCore, Version=5.0.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" []. [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\administration\src\IBP.AdministrationService.EntityFrameworkCore\bin\Debug\net5.0\IBP.AdministrationService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: Project file item includes which caused reference "C:\Folder\IBP\services\administration\src\IBP.AdministrationService.EntityFrameworkCore\bin\Debug\net5.0\IBP.AdministrationService.EntityFrameworkCore.dll". [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\administration\src\IBP.AdministrationService.EntityFrameworkCore\bin\Debug\net5.0\IBP.AdministrationService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\identity\src\IBP.IdentityService.EntityFrameworkCore\bin\Debug\net5.0\IBP.IdentityService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: Project file item includes which caused reference "C:\Folder\IBP\services\identity\src\IBP.IdentityService.EntityFrameworkCore\bin\Debug\net5.0\IBP.IdentityService.EntityFrameworkCore.dll". [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\identity\src\IBP.IdentityService.EntityFrameworkCore\bin\Debug\net5.0\IBP.IdentityService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\saas\src\IBP.SaasService.EntityFrameworkCore\bin\Debug\net5.0\IBP.SaasService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: Project file item includes which caused reference "C:\Folder\IBP\services\saas\src\IBP.SaasService.EntityFrameworkCore\bin\Debug\net5.0\IBP.SaasService.EntityFrameworkCore.dll". [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\saas\src\IBP.SaasService.EntityFrameworkCore\bin\Debug\net5.0\IBP.SaasService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: Found conflicts between different versions of "Microsoft.EntityFrameworkCore.Relational" that could not be resolved. [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: There was a conflict between "Microsoft.EntityFrameworkCore.Relational, Version=5.0.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" and "Microsoft.EntityFrameworkCore.Relational, Version=5.0.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60". [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: "Microsoft.EntityFrameworkCore.Relational, Version=5.0.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was chosen because it was primary and "Microsoft.EntityFrameworkCore.Relational, Version=5.0.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" was not. [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: References which depend on "Microsoft.EntityFrameworkCore.Relational, Version=5.0.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" [C:\Users\NAME\.nuget\packages\microsoft.entityframeworkcore.relational\5.0.6\lib\netstandard2.1\Microsoft.EntityFrameworkCore.Relational.dll]. [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Users\NAME\.nuget\packages\microsoft.entityframeworkcore.relational\5.0.6\lib\netstandard2.1\Microsoft.EntityFrameworkCore.Relational.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: Project file item includes which caused reference "C:\Users\NAME\.nuget\packages\microsoft.entityframeworkcore.relational\5.0.6\lib\netstandard2.1\Microsoft.EntityFrameworkCore.Relational.dll". [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Users\NAME\.nuget\packages\microsoft.entityframeworkcore.relational\5.0.6\lib\netstandard2.1\Microsoft.EntityFrameworkCore.Relational.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: References which depend on "Microsoft.EntityFrameworkCore.Relational, Version=5.0.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" []. [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\administration\src\IBP.AdministrationService.EntityFrameworkCore\bin\Debug\net5.0\IBP.AdministrationService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: Project file item includes which caused reference "C:\Folder\IBP\services\administration\src\IBP.AdministrationService.EntityFrameworkCore\bin\Debug\net5.0\IBP.AdministrationService.EntityFrameworkCore.dll". [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\administration\src\IBP.AdministrationService.EntityFrameworkCore\bin\Debug\net5.0\IBP.AdministrationService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\identity\src\IBP.IdentityService.EntityFrameworkCore\bin\Debug\net5.0\IBP.IdentityService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: Project file item includes which caused reference "C:\Folder\IBP\services\identity\src\IBP.IdentityService.EntityFrameworkCore\bin\Debug\net5.0\IBP.IdentityService.EntityFrameworkCore.dll". [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\identity\src\IBP.IdentityService.EntityFrameworkCore\bin\Debug\net5.0\IBP.IdentityService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\saas\src\IBP.SaasService.EntityFrameworkCore\bin\Debug\net5.0\IBP.SaasService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: Project file item includes which caused reference "C:\Folder\IBP\services\saas\src\IBP.SaasService.EntityFrameworkCore\bin\Debug\net5.0\IBP.SaasService.EntityFrameworkCore.dll". [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] C:\Program Files\dotnet\sdk\5.0.300\Microsoft.Common.CurrentVersion.targets(2202,5): warning MSB3277: C:\Folder\IBP\services\saas\src\IBP.SaasService.EntityFrameworkCore\bin\Debug\net5.0\IBP.SaasService.EntityFrameworkCore.dll [C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\IBP.AuthServer.csproj] [16:58:02 INF] Starting IBP.AuthServer. [16:58:02 FTL] IBP.AuthServer terminated unexpectedly! Volo.Abp.AbpInitializationException: An error occurred during ConfigureServices phase of the module IBP.AdministrationService.EntityFrameworkCore.AdministrationServiceEntityFrameworkCoreModule, IBP.AdministrationService.EntityFrameworkCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore, Version=5.0.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.EntityFrameworkCore, Version=5.0.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' at IBP.AdministrationService.EntityFrameworkCore.AdministrationServiceEntityFrameworkCoreModule.ConfigureServices(ServiceConfigurationContext context) at Volo.Abp.AbpApplicationBase.ConfigureServices() --- End of inner exception stack trace --- at Volo.Abp.AbpApplicationBase.ConfigureServices() at Volo.Abp.AbpApplicationBase..ctor(Type startupModuleType, IServiceCollection services, Action1 optionsAction) at Volo.Abp.AbpApplicationWithExternalServiceProvider..ctor(Type startupModuleType, IServiceCollection services, Action1 optionsAction) at Volo.Abp.AbpApplicationFactory.Create(Type startupModuleType, IServiceCollection services, Action1 optionsAction) at Volo.Abp.AbpApplicationFactory.Create[TStartupModule](IServiceCollection services, Action1 optionsAction) at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplication[TStartupModule](IServiceCollection services, Action1 optionsAction) at IBP.AuthServer.Startup.ConfigureServices(IServiceCollection services) in C:\Folder\IBP\apps\auth-server\src\IBP.AuthServer\Startup.cs:line 11 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<&gt;c__DisplayClass9_0.g__Startup|0(IServiceCollection serviceCollection)

at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.b__0(IServiceCollection services)

at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance) at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.b__0(HostBuilderContext context, IServiceCollection services)

at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider() at Microsoft.Extensions.Hosting.HostBuilder.Build()`


5 Answer(s)
  • 0
    [email protected] created

    I think that I found the problem. Please update the packages so in all project the same version of Microsoft.EntityFrameworkCore is used. In the Test project 5.0.6 is loaded from the Sqllite package.

    Another problem I have now is that I cannot add the new solution to ABP Suite. So I cannot run package updates from there. It looks there is a bug in ABP 4.3.2

  • 0
    albert created
    Support Team

    Run the following command:

    dotnet nuget locals --clear http-cache
    

    See the related issue https://github.com/NuGet/Home/issues/5445

  • 0
    albert created
    Support Team

    Install the latest .NET Core SDK (5.0.7) https://dotnet.microsoft.com/download/dotnet/5.0

  • 0
    [email protected] created

    Albert, I installed this version but that didn't solve this issue.

    When I take the AdministrationService from the Microservice solution, clean solution and do dotnet build command in terminal, I still have this error: CSC : error CS1705: Assembly 'IBP.AdministrationService.EntityFrameworkCore' with identity 'IBP.AdministrationService.EntityFrameworkCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.EntityFrameworkCore, Version=5.0.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.EntityFrameworkCore' with identity 'Microsoft.EntityFrameworkCore, Version=5.0.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' [\*\*\*\services\administration\test\IBP.AdministrationService.EntityFrameworkCore.Tests\IBP.AdministrationService.EntityFrameworkCore.Tests.csproj]

    When I add this line in the IBP.AdministrationService.EntityFrameworkCore.Tests projectfile, it all works.

    So it still looks on a version issue in the ABP package. Please cross check this.

    Thanks, Rick

  • 0
    albert created
    Support Team

    there's a workaround for this issue.

    Open YourMicroserviceSolution.IdentityService.EntityFrameworkCore.csproj project file and delete the <PrivateAssets>all</PrivateAssets> section. This will solve the version conflict.

    <Project Sdk="Microsoft.NET.Sdk">
    
        <PropertyGroup>
            <TargetFramework>net5.0</TargetFramework>
            <RootNamespace>MyAngulaarMicroservice.IdentityService</RootNamespace>
        </PropertyGroup>
    
        <ItemGroup>
            <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.*">
                
    			<!-- delete this -->
    			<PrivateAssets>all</PrivateAssets>
    			
    			
                <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
            </PackageReference>
        </ItemGroup>
    
        <ItemGroup>
            <PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="4.3.2" />
            <PackageReference Include="Volo.Abp.Identity.Pro.EntityFrameworkCore" Version="4.3.2" />
            <PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="4.3.2" />
        </ItemGroup>
    
        <ItemGroup>
            <ProjectReference Include="..\MyAngulaarMicroservice.IdentityService.Domain\MyAngulaarMicroservice.IdentityService.Domain.csproj" />
        </ItemGroup>
    
    </Project>