Open StephanBis opened 2 years ago
/cc @bricelam
Possible duplicate of #16882.
@StephanBis Can you post your csproj?
Hello! Sorry to hijack, but my team has been running into this problem this week. This is our csproj.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Redacted.Project.Data</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.29.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" />
</ItemGroup>
</Project>
We have tried removing both the DotNetCliToolReference Item Group and the Microsoft.EntityFrameworkCore.Tools.DotNet PackageReference along with many other random attempts.
Note: Our startup project is a separate project, this project has a single DbContext which is the only DbContext in the solution
@krsnider This:
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" />
is an extremely old and obsolete package. It was replaced by the dotnet-ef
before EF Core 2.1 shipped, but neither are intended to be referenced using PackageReference
from a csproj.
Note for triage: the package is already listed as obsolete here: https://docs.microsoft.com/en-us/ef/core/what-is-new/nuget-packages
Sorry for the late reaction.
Our database .csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
</ItemGroup>
</Project>
Our startup project
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.5.1" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="10.0.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.20.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
</Project>
As you can see we are not using the above mentioned Microsoft.EntityFrameworkCore.Tools.DotNet
.
@bricelam cc
Any update on this? I see that this is added to the 7.0.0 milestone.
@StephanBis We don't yet understand what is going on here. The plan is to investigate and hopefully fix in 7.0 if we find the root cause. The workaround for now is to install .NET 2.x where needed.
This may have been fixed by PR #27671
We're trying to get the Bundle-Migration to work so we can integrate migrations in our CI/CD pipelines. We are however facing some issues.
When using the dotnet CLI, we're getting the following error
When using the Package Manager Console Bundle-Migration command
We do not understand why the dotnet CLI is complaining about .NET Core 2.0.0 as we are not referencing any packages that require this framework. On the other hand our projects restore and build just fine, no issues. So we also do not quite understand why ef-tools cannot restore some projects.
Versions: