Alan B
Alan B

Reputation: 4288

.NET 6 Project builds successfully but won't build during any 'dotnet ef' command

I have an EF Core data layer project that is part of a bigger solution. It targets:

It builds successfully in the normal way in Visual Studio, however when building as part of (for example) issuing a 'dotnet ef migrations list' command in the Package Manager console, it fails with:

An assembly specified in the application dependencies manifest (DataProvider2.deps.json) was not found:
package: 'runtimepack.Microsoft.Windows.SDK.NET.Ref', version: '10.0.19041.25'
path: 'Microsoft.Windows.SDK.NET.dll'

I have tried

What I don't understand is where it's getting '10.0.19041.25' from. I can't find it anywhere in any metadata files. I can't install the Nuget Package (dotnet add package Microsoft.Windows.SDK.NET.Ref --version 10.0.19041.25) as it targets the .NET Framework.

Where else could this reference be coming from?

Upvotes: 4

Views: 1111

Answers (1)

Alan B
Alan B

Reputation: 4288

As always enlightenment comes after you post an SO question.

I created a new project and copied all the code into it and verified that it worked with EF Core commands. I then compared the .csproj files.

Apparently this is bad:

    <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>

but this is good:

<TargetFramework>net6.0</TargetFramework>

In case that helps anyone else.

Upvotes: 4

Related Questions