.net core “为什么?”;dotnet ef迁移添加;抛出Win32Exception?
我有一个DotnetCoreV3.1项目,其中包含实体框架DbContext。 当我尝试跑步时:.net core “为什么?”;dotnet ef迁移添加;抛出Win32Exception?,.net-core,entity-framework-core,dotnet-cli,.net Core,Entity Framework Core,Dotnet Cli,我有一个DotnetCoreV3.1项目,其中包含实体框架DbContext。 当我尝试跑步时: dotnet ef migrations add someMigrationName 将引发此异常: System.ComponentModel.Win32Exception (2): No such file or directory at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] arg
dotnet ef migrations add someMigrationName
将引发此异常:
System.ComponentModel.Win32Exception (2): No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
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(String[] _)
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0(String[] args)
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
No such file or directory
这是在我的环境中运行dotnet--info的结果:
.NET Core SDK (reflecting any global.json):
Version: 3.1.405
Commit: 3fae16e62e
Runtime Environment:
OS Name: elementary
OS Version: 5.1.7
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/3.1.405/
Host (useful for support):
Version: 3.1.11
Commit: f5eceb8105
.NET Core SDKs installed:
3.1.405 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
你有其他的项目解决方案吗是的,我有,但是我在我的特定项目的根目录下用dbcontext运行了这个命令。这可能会有帮助。我最近看到了这个线程,但不能理解其中的要点@YinqiuI认为您应该检查您的路径和权限。
.NET Core SDK (reflecting any global.json):
Version: 3.1.405
Commit: 3fae16e62e
Runtime Environment:
OS Name: elementary
OS Version: 5.1.7
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/3.1.405/
Host (useful for support):
Version: 3.1.11
Commit: f5eceb8105
.NET Core SDKs installed:
3.1.405 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download