efcore: System.ComponentModel.Win32Exception when using ef tools

From @jhoward321 on Thursday, June 13, 2019 3:36:44 AM

Steps to reproduce

Run any dotnet ef command inside a working repo. I’m using the 2.2.107 sdk from the https://copr.fedorainfracloud.org/coprs/g/dotnet-sig/dotnet/ repo. Unfortunately there is not a newer sdk available.

Expected behavior

Show existing migrations

Actual behavior

$ dotnet ef migrations list                          
System.ComponentModel.Win32Exception (2): No such file or directory
   at Interop.Sys.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setUser, UInt32 userId, UInt32 groupId, Int32& lpChildPid, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean shouldThrow)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Microsoft.EntityFrameworkCore.Tools.Exe.Run(String executable, IReadOnlyList`1 args, String workingDirectory, Boolean interceptOutput)
   at Microsoft.EntityFrameworkCore.Tools.Project.FromFile(String file, String buildExtensionsDir, String framework, String configuration, String runtime)
   at Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute()
   at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
No such file or directory

Environment data

$ dotnet --info            
.NET Core SDK (reflecting any global.json):
 Version:   2.2.107
 Commit:    2212cac826

Runtime Environment:
 OS Name:     fedora
 OS Version:  30
 OS Platform: Linux
 RID:         fedora.30-x64
 Base Path:   /usr/lib64/dotnet/sdk/2.2.107/

Host (useful for support):
  Version: 2.2.5
  Commit:  0a3c9209c0

.NET Core SDKs installed:
  2.2.107 [/usr/lib64/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.NETCore.App 2.2.5 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Copied from original issue: dotnet/cli#11542

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

@jhoward321 I also hit the same issue. For me it turned out to be a bad symlink i had created for dotnet (/usr/local/bin/dotnet). Doing an unlink on this fixed the issue for me.

From @omajid on Thursday, June 13, 2019 2:47:16 PM

The output of dotnet ef -v migrations list would be nice to have.