【问题标题】:Add-Migration throws Win32Exception in VS Community 2022Add-Migration 在 VS Community 2022 中引发 Win32Exception
【发布时间】:2022-06-22 04:14:09
【问题描述】:

我有一个使用 VS Community 2022 的简单 WebAPI 项目 (.NET 6),我正在尝试使用以下命令在包管理器控制台中添加迁移:

add-migration initial

这会导致以下错误:

add-migration : Exception calling "Start" with "1" argument(s): "The specified executable is not a valid application for this OS platform."
At line:1 char:1
+ add-migration initial
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-Migration], MethodInvocationException
    + FullyQualifiedErrorId : Win32Exception,Add-Migration

我已经安装了以下 NuGet 包:

Microsoft.EntityFrameworkCore

Microsoft.EntityFrameworkCore.Tools

Microsoft.EntityFrameworkCore.Design

Microsoft.EntityFrameworkCore.SqlServer

完全相同的代码在 VS Community 2019 (.NET 5) 上运行没有任何问题,所以我认为它与代码没有任何关系。 即使是 VS 2022 中的空 WebAPI 项目(安装了 Microsoft.EntityFrameworkCore.Tools 包)也会引发相同的 Win32Exception。另一方面,在 VS 2019 中,空的 WebAPI 项目(安装了 Microsoft.EntityFrameworkCore.Tools 包)给出了“未找到 DbContext”错误,这是预期的。 我也尝试过重新安装软件包并重新启动 Visual Studio,但它没有用。非常感谢您的帮助!

【问题讨论】:

  • @stuartd 没有。我已经试过了。
  • 那你为什么不把它加到你的问题中呢? “你已经尝试过的”是必不可少的信息,
  • 添加-Verbose 是否提供任何其他信息?

标签: c# .net entity-framework-core visual-studio-2022


【解决方案1】:

有人解决了吗?我有同样的问题是VS2022社区

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-12-01
    • 2021-07-06
    • 2021-12-30
    • 2020-02-26
    • 2023-03-09
    • 2017-02-17
    • 2020-11-27
    • 1970-01-01
    相关资源
    最近更新 更多