【问题标题】:VSCode on M1 Mac wont run "dotnet ef" command in TerminalM1 Mac 上的 VSCode 不会在终端中运行“dotnet ef”命令
【发布时间】:2021-10-05 12:57:06
【问题描述】:

我不确定 EFCore 是否应该适用于处于 6.0.0 预览版的 M1 Mac。我正在上一门 udemy 课程,但我无法在终端中运行“dotnet ef”命令进行迁移。

me@my-MBP-2 dotnet-rpg % dotnet tool update --global dotnet-ef 
Tool 'dotnet-ef' was reinstalled with the latest stable version (version '5.0.8').

me@my-MBP-2 dotnet-rpg % dotnet ef -h    
me@my-MBP-2 dotnet-rpg % 

我尝试将所有 EFCore 包更新到 6.0.0 版本,认为我的决心但仍然没有成功。

这是我的 .csproj 文件。

<Project Sdk="Microsoft.NET.Sdk.Web">

 <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <RootNamespace>dotnet_rpg</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.8" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.8" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0-preview.6.21352.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0-preview.6.21352.1">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0-preview.6.21352.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0-preview.6.21352.1">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
  </ItemGroup>

</Project>

如果我做错了什么,你能建议吗?

【问题讨论】:

    标签: macos visual-studio-code .net-core entity-framework-core


    【解决方案1】:

    我遇到了同样的问题,似乎 dotnet ef 还没有在 M1 处理器上工作。

    对于我的项目,我必须通过在 Windows 机器上检查我的工作分支并成功运行相同的命令(具有相同的 dotnet 版本)来生成迁移脚本。

    在带有 Windows 11 的 Parallels 上,我无法让 dotnet tool 工作(抛出异常)并且无法正确测试。

    【讨论】:

      【解决方案2】:

      这里是问题:https://github.com/dotnet/efcore/issues/25927

      您可以在本地安装dotnet-ef作为解决方案:

      dotnet new tool-manifest # if you are setting up this repo
      
      dotnet tool install --local dotnet-ef --version 6.0.0-rc.2.21480.5
      

      【讨论】:

        猜你喜欢
        • 2021-02-17
        • 2022-07-19
        • 1970-01-01
        • 1970-01-01
        • 2017-04-08
        • 1970-01-01
        • 1970-01-01
        • 2015-12-26
        • 1970-01-01
        相关资源
        最近更新 更多