1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Entity Framework CoreのマイグレーションがWindows SDKバージョン指定プロジェクトでエラーになる問題の解決方法

Last updated at Posted at 2024-11-01

概要

Entity Framework Coreを使う場合に、Windows向けのプロジェクトでマイグレーションがエラーになるという問題にぶつかったので、その解決方法です。

解決方法

プロジェクトのターゲットに、次のようにWindowsSDKのバージョン指定が入っている場合に発生します。

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

解決方法としては、いったん次のようにWindowsSDK指定を外して実行した後、また元に戻せばOKです。

<TargetFramework>net8.0</TargetFramework>

理由ははっきりしないのですが、エラー内容が次のようになっているため、指定されたバージョンのWindowsSDKのDLLを探しに行き、該当のものが無いためにエラーになっているように見えます。

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

同じような問題に .NET 6で引っかかっているスレッドも見かけたので、EF Coreの仕様なのかもしれません。

ごく普通のWindowsSDK指定のプロジェクトで使っていきなりエラーになるというのも困ったものですが・・・知っていれば回避することは簡単なので、面倒ですが運用で何とかするしかなさそうです。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?