Failed to create migration. EF Core tools is older than some version2019 Community Moderator ElectionCross-thread operation not valid: Control accessed from a thread other than the thread it was created onRemoving files that are older than some number of daysHow do you create a custom AuthorizeAttribute in ASP.NET Core?How to unapply a migration in ASP.NET Core with EF CoreEF Core 1.1 to WebApi Core - Add-Migration failsEF Core add-migration Build FailedMigrate EF Core tablesEF Core tools version update 2.1.1The EF Core tools in error when create the migrationEF Core migration fails, table already created

Brexit - No Deal Rejection

Do I need to be arrogant to get ahead?

Python if-else code style for reduced code for rounding floats

Are all passive ability checks floors for active ability checks?

Equivalents to the present tense

How do I change two letters closest to a string and one letter immediately after a string using Notepad++?

What options are left, if Britain cannot decide?

Simplify an interface for flexibly applying rules to periods of time

If I can solve Sudoku, can I solve the Travelling Salesman Problem (TSP)? If so, how?

Is honey really a supersaturated solution? Does heating to un-crystalize redissolve it or melt it?

Official degrees of earth’s rotation per day

Is it insecure to send a password in a `curl` command?

Welcoming 2019 Pi day: How to draw the letter π?

How to deal with taxi scam when on vacation?

Knife as defense against stray dogs

Why do newer 737s use two different styles of split winglets?

How do you talk to someone whose loved one is dying?

What is the significance behind "40 days" that often appears in the Bible?

Is "upgrade" the right word to use in this context?

Math equation in non italic font

Shortcut for setting origin to vertex

et qui - how do you really understand that kind of phraseology?

Meme-controlled people

A diagram about partial derivatives of f(x,y)



Failed to create migration. EF Core tools is older than some version



2019 Community Moderator ElectionCross-thread operation not valid: Control accessed from a thread other than the thread it was created onRemoving files that are older than some number of daysHow do you create a custom AuthorizeAttribute in ASP.NET Core?How to unapply a migration in ASP.NET Core with EF CoreEF Core 1.1 to WebApi Core - Add-Migration failsEF Core add-migration Build FailedMigrate EF Core tablesEF Core tools version update 2.1.1The EF Core tools in error when create the migrationEF Core migration fails, table already created










0















I am trying to create an Init migration for my simple project.
But I am getting next error:



C:RiderProjectsArchitectureArchitecture>dotnet ef migrations add init
The EF Core tools version '2.1.8-servicing-32085' is older than that of the runtime '2.2.2-servicing-10034'. Update the tools for the latest features and bug fixes.
Unable to create an object of type 'DomainContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728


Which doesn't make any sence, because if we take alook at my NuGet dependencies:



enter image description here



there is no older Core.Tools version - it is 2.2.2.



Here is my Context class (maybe the problem is hidden inside this class):



public class DomainContext : DbContext

private readonly IConfiguration _configuration;

public DomainContext(IConfiguration configuration)

_configuration = configuration;


public DbSet<Car> Car get; set;
public DbSet<Company> Company get; set;
public DbSet<Location> Location get; set;

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

if (!optionsBuilder.IsConfigured)

optionsBuilder.UseSqlServer(_configuration.GetConnectionString("DefaultConnection"));



protected override void OnModelCreating(ModelBuilder modelBuilder)

modelBuilder.Entity<Company>(CompanyMapping.Config);




Could anybody please suggest the solution ?
EDIT
Here is .csproj file:



 <ItemGroup>
<PackageReference Include="EntityFramework" Version="6.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="SimpleInjector" Version="4.4.3" />
</ItemGroup>


BIG UPDATE



Make sure you have default constructor for Context Class.










share|improve this question




























    0















    I am trying to create an Init migration for my simple project.
    But I am getting next error:



    C:RiderProjectsArchitectureArchitecture>dotnet ef migrations add init
    The EF Core tools version '2.1.8-servicing-32085' is older than that of the runtime '2.2.2-servicing-10034'. Update the tools for the latest features and bug fixes.
    Unable to create an object of type 'DomainContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728


    Which doesn't make any sence, because if we take alook at my NuGet dependencies:



    enter image description here



    there is no older Core.Tools version - it is 2.2.2.



    Here is my Context class (maybe the problem is hidden inside this class):



    public class DomainContext : DbContext

    private readonly IConfiguration _configuration;

    public DomainContext(IConfiguration configuration)

    _configuration = configuration;


    public DbSet<Car> Car get; set;
    public DbSet<Company> Company get; set;
    public DbSet<Location> Location get; set;

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

    if (!optionsBuilder.IsConfigured)

    optionsBuilder.UseSqlServer(_configuration.GetConnectionString("DefaultConnection"));



    protected override void OnModelCreating(ModelBuilder modelBuilder)

    modelBuilder.Entity<Company>(CompanyMapping.Config);




    Could anybody please suggest the solution ?
    EDIT
    Here is .csproj file:



     <ItemGroup>
    <PackageReference Include="EntityFramework" Version="6.2.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.2" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
    <PackageReference Include="SimpleInjector" Version="4.4.3" />
    </ItemGroup>


    BIG UPDATE



    Make sure you have default constructor for Context Class.










    share|improve this question


























      0












      0








      0








      I am trying to create an Init migration for my simple project.
      But I am getting next error:



      C:RiderProjectsArchitectureArchitecture>dotnet ef migrations add init
      The EF Core tools version '2.1.8-servicing-32085' is older than that of the runtime '2.2.2-servicing-10034'. Update the tools for the latest features and bug fixes.
      Unable to create an object of type 'DomainContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728


      Which doesn't make any sence, because if we take alook at my NuGet dependencies:



      enter image description here



      there is no older Core.Tools version - it is 2.2.2.



      Here is my Context class (maybe the problem is hidden inside this class):



      public class DomainContext : DbContext

      private readonly IConfiguration _configuration;

      public DomainContext(IConfiguration configuration)

      _configuration = configuration;


      public DbSet<Car> Car get; set;
      public DbSet<Company> Company get; set;
      public DbSet<Location> Location get; set;

      protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

      if (!optionsBuilder.IsConfigured)

      optionsBuilder.UseSqlServer(_configuration.GetConnectionString("DefaultConnection"));



      protected override void OnModelCreating(ModelBuilder modelBuilder)

      modelBuilder.Entity<Company>(CompanyMapping.Config);




      Could anybody please suggest the solution ?
      EDIT
      Here is .csproj file:



       <ItemGroup>
      <PackageReference Include="EntityFramework" Version="6.2.0" />
      <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.2" />
      <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
      <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.2" />
      <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
      <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
      <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
      <PackageReference Include="SimpleInjector" Version="4.4.3" />
      </ItemGroup>


      BIG UPDATE



      Make sure you have default constructor for Context Class.










      share|improve this question
















      I am trying to create an Init migration for my simple project.
      But I am getting next error:



      C:RiderProjectsArchitectureArchitecture>dotnet ef migrations add init
      The EF Core tools version '2.1.8-servicing-32085' is older than that of the runtime '2.2.2-servicing-10034'. Update the tools for the latest features and bug fixes.
      Unable to create an object of type 'DomainContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728


      Which doesn't make any sence, because if we take alook at my NuGet dependencies:



      enter image description here



      there is no older Core.Tools version - it is 2.2.2.



      Here is my Context class (maybe the problem is hidden inside this class):



      public class DomainContext : DbContext

      private readonly IConfiguration _configuration;

      public DomainContext(IConfiguration configuration)

      _configuration = configuration;


      public DbSet<Car> Car get; set;
      public DbSet<Company> Company get; set;
      public DbSet<Location> Location get; set;

      protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

      if (!optionsBuilder.IsConfigured)

      optionsBuilder.UseSqlServer(_configuration.GetConnectionString("DefaultConnection"));



      protected override void OnModelCreating(ModelBuilder modelBuilder)

      modelBuilder.Entity<Company>(CompanyMapping.Config);




      Could anybody please suggest the solution ?
      EDIT
      Here is .csproj file:



       <ItemGroup>
      <PackageReference Include="EntityFramework" Version="6.2.0" />
      <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.2" />
      <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" />
      <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.2" />
      <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
      <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
      <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
      <PackageReference Include="SimpleInjector" Version="4.4.3" />
      </ItemGroup>


      BIG UPDATE



      Make sure you have default constructor for Context Class.







      c# entity-framework






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 7 at 16:54







      Andrew

















      asked Mar 7 at 15:10









      AndrewAndrew

      103316




      103316






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Have a look at your .csproj file. Maybe there is an older version targeted in a PackageReference node.






          share|improve this answer























          • Sir, I have attached the file. Seems there is no older version. Unfortunately.

            – Andrew
            Mar 7 at 15:23











          • Hm, ok. Can you try to reinstall core tools to the latest/desired version (i.e. Package Manager console: Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.2.2)? Maybe there is a mismatch under the hood that gets fixed by that.

            – Grimm
            Mar 7 at 15:33











          • Or "dotnet add package Microsoft.EntityFrameworkCore.Tools --version 2.2.2" if you're working with .NET CLI.

            – Grimm
            Mar 7 at 15:34











          • still no luck. I have a sense that maybe somewhere the versions are cached ? Or it is not the case ?

            – Andrew
            Mar 7 at 15:38












          • Sorry to hear that - at the moment I don't have any other suggestions but would come back to this if I get to know something that may help you. I'm not aware of any caching concerning this issue.

            – Grimm
            Mar 7 at 15:41










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55047034%2ffailed-to-create-migration-ef-core-tools-is-older-than-some-version%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Have a look at your .csproj file. Maybe there is an older version targeted in a PackageReference node.






          share|improve this answer























          • Sir, I have attached the file. Seems there is no older version. Unfortunately.

            – Andrew
            Mar 7 at 15:23











          • Hm, ok. Can you try to reinstall core tools to the latest/desired version (i.e. Package Manager console: Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.2.2)? Maybe there is a mismatch under the hood that gets fixed by that.

            – Grimm
            Mar 7 at 15:33











          • Or "dotnet add package Microsoft.EntityFrameworkCore.Tools --version 2.2.2" if you're working with .NET CLI.

            – Grimm
            Mar 7 at 15:34











          • still no luck. I have a sense that maybe somewhere the versions are cached ? Or it is not the case ?

            – Andrew
            Mar 7 at 15:38












          • Sorry to hear that - at the moment I don't have any other suggestions but would come back to this if I get to know something that may help you. I'm not aware of any caching concerning this issue.

            – Grimm
            Mar 7 at 15:41















          0














          Have a look at your .csproj file. Maybe there is an older version targeted in a PackageReference node.






          share|improve this answer























          • Sir, I have attached the file. Seems there is no older version. Unfortunately.

            – Andrew
            Mar 7 at 15:23











          • Hm, ok. Can you try to reinstall core tools to the latest/desired version (i.e. Package Manager console: Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.2.2)? Maybe there is a mismatch under the hood that gets fixed by that.

            – Grimm
            Mar 7 at 15:33











          • Or "dotnet add package Microsoft.EntityFrameworkCore.Tools --version 2.2.2" if you're working with .NET CLI.

            – Grimm
            Mar 7 at 15:34











          • still no luck. I have a sense that maybe somewhere the versions are cached ? Or it is not the case ?

            – Andrew
            Mar 7 at 15:38












          • Sorry to hear that - at the moment I don't have any other suggestions but would come back to this if I get to know something that may help you. I'm not aware of any caching concerning this issue.

            – Grimm
            Mar 7 at 15:41













          0












          0








          0







          Have a look at your .csproj file. Maybe there is an older version targeted in a PackageReference node.






          share|improve this answer













          Have a look at your .csproj file. Maybe there is an older version targeted in a PackageReference node.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 7 at 15:15









          GrimmGrimm

          211111




          211111












          • Sir, I have attached the file. Seems there is no older version. Unfortunately.

            – Andrew
            Mar 7 at 15:23











          • Hm, ok. Can you try to reinstall core tools to the latest/desired version (i.e. Package Manager console: Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.2.2)? Maybe there is a mismatch under the hood that gets fixed by that.

            – Grimm
            Mar 7 at 15:33











          • Or "dotnet add package Microsoft.EntityFrameworkCore.Tools --version 2.2.2" if you're working with .NET CLI.

            – Grimm
            Mar 7 at 15:34











          • still no luck. I have a sense that maybe somewhere the versions are cached ? Or it is not the case ?

            – Andrew
            Mar 7 at 15:38












          • Sorry to hear that - at the moment I don't have any other suggestions but would come back to this if I get to know something that may help you. I'm not aware of any caching concerning this issue.

            – Grimm
            Mar 7 at 15:41

















          • Sir, I have attached the file. Seems there is no older version. Unfortunately.

            – Andrew
            Mar 7 at 15:23











          • Hm, ok. Can you try to reinstall core tools to the latest/desired version (i.e. Package Manager console: Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.2.2)? Maybe there is a mismatch under the hood that gets fixed by that.

            – Grimm
            Mar 7 at 15:33











          • Or "dotnet add package Microsoft.EntityFrameworkCore.Tools --version 2.2.2" if you're working with .NET CLI.

            – Grimm
            Mar 7 at 15:34











          • still no luck. I have a sense that maybe somewhere the versions are cached ? Or it is not the case ?

            – Andrew
            Mar 7 at 15:38












          • Sorry to hear that - at the moment I don't have any other suggestions but would come back to this if I get to know something that may help you. I'm not aware of any caching concerning this issue.

            – Grimm
            Mar 7 at 15:41
















          Sir, I have attached the file. Seems there is no older version. Unfortunately.

          – Andrew
          Mar 7 at 15:23





          Sir, I have attached the file. Seems there is no older version. Unfortunately.

          – Andrew
          Mar 7 at 15:23













          Hm, ok. Can you try to reinstall core tools to the latest/desired version (i.e. Package Manager console: Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.2.2)? Maybe there is a mismatch under the hood that gets fixed by that.

          – Grimm
          Mar 7 at 15:33





          Hm, ok. Can you try to reinstall core tools to the latest/desired version (i.e. Package Manager console: Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.2.2)? Maybe there is a mismatch under the hood that gets fixed by that.

          – Grimm
          Mar 7 at 15:33













          Or "dotnet add package Microsoft.EntityFrameworkCore.Tools --version 2.2.2" if you're working with .NET CLI.

          – Grimm
          Mar 7 at 15:34





          Or "dotnet add package Microsoft.EntityFrameworkCore.Tools --version 2.2.2" if you're working with .NET CLI.

          – Grimm
          Mar 7 at 15:34













          still no luck. I have a sense that maybe somewhere the versions are cached ? Or it is not the case ?

          – Andrew
          Mar 7 at 15:38






          still no luck. I have a sense that maybe somewhere the versions are cached ? Or it is not the case ?

          – Andrew
          Mar 7 at 15:38














          Sorry to hear that - at the moment I don't have any other suggestions but would come back to this if I get to know something that may help you. I'm not aware of any caching concerning this issue.

          – Grimm
          Mar 7 at 15:41





          Sorry to hear that - at the moment I don't have any other suggestions but would come back to this if I get to know something that may help you. I'm not aware of any caching concerning this issue.

          – Grimm
          Mar 7 at 15:41



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55047034%2ffailed-to-create-migration-ef-core-tools-is-older-than-some-version%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

          List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229