2

I'm working with visual studio 2019 for mac and Im trying to create an API dotnet CORE project, but I have some issues at execute this command

dotnet ef dbcontext Scaffold "ConnectionString" Microsoft.EntityFrameworkCore.SqlServer -o Models -c GoParkingContext

This is the error I get:

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()
   at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0()
   at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
No such file or directory

This is the csproj file:

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>


  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.4" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.4">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.4">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Models\" />
  </ItemGroup>
</Project>

I'm looking a lot on the internet but I don't get the solution. Appreciate help

alejo
  • 21
  • 2
  • "I have some issues at execute this command", then where did you execute the command? – Lex Li May 27 '20 at 02:20
  • I execute on mac terminal positioned on project folder – alejo May 27 '20 at 03:40
  • I achieved install package manage console on visual studio for mac! Once to it this, I try to run the comand, but got the same error! **This is the command:** Scaffold-DbContext “’Data Source=104.198.76.145;Initial Catalog=GOPARKING;User ID=goparkingadmin; Password=2020goparking;’” ’Microsoft.EntityFrameworkCore.SqlServer’ -OutputDir ‘Models’ -Context ‘GoParkingContext’ -verbose **The error:** Scaffold-DbContext : Exception calling "Start" with "1" argument(s): "No such file or directory"' At line:1 char:1 – alejo May 28 '20 at 02:51
  • I faced with the same problem. dotnet was under HOME directory, then i uninstalled and reinstall by using pkg file. now it worked. weird. – Ferhat Apr 16 '21 at 09:16

1 Answers1

0

I also had this issue and the solution was to create a symbolic link from dotnet binary to /usr/bin/dotnet

antun
  • 51
  • 3