'Add-Migration throws Win32Exception in VS Community 2022
I have a simple WebAPI project (.NET 6) using VS Community 2022 and I'm trying to add a migration in package manager console with the following command:
add-migration initial
which leads to the following error:
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
I have installed the following NuGet Packages:
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Tools
Microsoft.EntityFrameworkCore.Design
Microsoft.EntityFrameworkCore.SqlServer
The exact same code runs on VS Community 2019 (.NET 5) without any issues, so I don't think it has anything to do with the code. Even an empty WebAPI project in VS 2022 (with Microsoft.EntityFrameworkCore.Tools package installed) throws the same Win32Exception. On the other hand, in VS 2019, the empty WebAPI project (with Microsoft.EntityFrameworkCore.Tools package installed) gives the "No DbContext was found" error, which is expected. I've also tried reinstalling the packages and restarting visual studio and it didn't work. I'd appreciate your help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
