zoukankan      html  css  js  c++  java
  • EF Core 迁移过程遇到EF Core tools version版本不相符的解决方案

    如果你使用命令:

    PM> add-migration Inital

    提示如下信息时:

    The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.4-rtm-31024'

    解决方法大致一下几种:

    第一


    最近在跟着官方的文档学习 .NET Core 。 在写 “创建 Razor 页面 Web 应用” Demo 中的——“添加模型”这一篇的教程,“添加初始迁移”中遇到 “The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.3-rtm-32065'. Update the tools for the latest features and bug fixes.”这样的问题。

    这个问题是用 PMC 命令做“初始迁移”的时候出现的,找了很多方法都不行,也看了本机安装的 .NET Core 的版本(dotnet --version,dotnet --info)。

    最后解决办法: 项目文件夹下使用 .NET Core CLI 命令: dotnet ef migrations add Initial dotnet ef database update 完成后运行可以了

    第二


    编辑你的<项目名称>.csproj文件

    添加以下内容

    <Project Sdk="Microsoft.NET.Sdk.Web">
    
      <PropertyGroup>
        <TargetFramework>netcoreapp2.1</TargetFramework>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="Microsoft.AspNetCore.App" />
        <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.4" />
        <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
        <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.6" />
      </ItemGroup>
    
    </Project>

    然后运行命令:

    PM> Update-Package

  • 相关阅读:
    组合模式
    数据去重
    combiner
    合并文档
    对象锁 区别 类锁
    一个简单的死锁示例
    线程安全的单例模式
    线程安全与不安全(误解)
    tf.nn.max_pool 池化
    tf.nn.depthwise_conv2d 卷积
  • 原文地址:https://www.cnblogs.com/duanyong/p/10018025.html
Copyright © 2011-2022 走看看