update-database : Exception calling "Start" with "1"argument(s): "The specified executable is not a valid application for this OS platform."

Adrian Mlilo 1 Reputation point
2022-08-18T13:42:07.613+00:00

I got the same error when trying to update-database and l am using Windows 11 And VS 17,3

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,148 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,923 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Farid Uddin Kiron MSFT 456 Reputation points Microsoft Vendor
    2022-08-19T09:10:44.387+00:00

    Hi @Anonymous Regarding the exception you are having with you could follow below steps:

    Steps:1

    Go to Search option and typeEdit Environment Variable

    232719-image.png
    232739-image.png

    Steps:2

    Select environment variables, and select path , and move "dotnet" all the way up at Path
    232758-image.png

    Steps:3

    Then you have to delete ef core packages in .nuget folder under c:\users{username}.nuget

    232796-image.png

    Steps:4 Then you have to delete ef core nuget packages and reinstall them (i used 3.2.1 for ef core, design, tools, sqlserver),

    Steps:5 Rebuild project in Visual Studio, then redo add-migration initial -verbose in package manager console and it should work as expected.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,
    Md Farid Uddin Kiron

    0 comments No comments

  2. Adrian Mlilo 1 Reputation point
    2022-12-02T11:19:06.993+00:00

    Hi @Farid Uddin Kiron MSFT

    I followed the steps but the error persists.
    266590-systm-environment.png266547-environment-variables.png266661-deleted-nuget-packages.png266644-rebuild-and-reinstalled-the-packages.png

    0 comments No comments

  3. Adrian Mlilo 1 Reputation point
    2022-12-02T11:35:08.697+00:00

    Hi @Farid Uddin Kiron MSFT

    I followed the steps but the error persists.
    266590-systm-environment.png266547-environment-variables.png266661-deleted-nuget-packages.png266644-rebuild-and-reinstalled-the-packages.png

    0 comments No comments