Why am I getting a contentRootPath null exception when attempting to add a database migration in...











up vote
1
down vote

favorite












I have a .NET Core class library that is the data access layer for multiple web applications. I am using Entity Framework Core 1.1, but I'm having trouble with migrations through PMC. My initial migration worked successfully, but after updating the database and re-launching VS 2017 I get a null exception on the contentRootPath argument when attempting to migrate. I may have made some changes to the project after my successful migration, but I don't remember what they were. This is the error and stack trace:



Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFrameworkAdd-Migration' for Entity Framework 6.
System.ArgumentNullException: Value cannot be null.
Parameter name: contentRootPath
at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations..ctor(IOperationReporter reporter, Assembly assembly, Assembly startupAssembly, String environment, String projectDir, String contentRootPath, String rootNamespace)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<>c__DisplayClass4_0.<.ctor>b__4()
at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)


There is no config file in my migrations directory, and I can't find anything related in the DbContext class. Has anyone else ran into this issue, or know what is causing it?



SqlDbContext class:



using Microsoft.EntityFrameworkCore;
using DataLayer.Models.User;

namespace DataLayer.Context
{
public class SqlDbContext : DbContext
{
public DbSet<User> Users { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(MyDbConfig.SqlConnectionString);
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>()
.Ignore(m => m.FullName);

base.OnModelCreating(modelBuilder);
}
}
}









share|improve this question
























  • Are you using both EF6 and EFC?
    – mvermef
    Jun 22 '17 at 5:53










  • No, I am not using EF6, but it is in the project.
    – dzlp
    Jun 22 '17 at 19:03










  • I edited your tags... to only show EFC. Can you show us your references? Startup.cs and appsettings.json
    – mvermef
    Jun 22 '17 at 19:52












  • It's in a Class Library, so there is no Startup.cs or appsettings.json files. I am just storing my connection string in a static class, along with connection strings to other databases that I am accessing. I updated the code snipped with my references. And my mistake before, I meant that EF6 is in the solution, not the project.
    – dzlp
    Jun 23 '17 at 2:08












  • I just looked at my Nuget packages, and for some reason my EntityFrameworkCore.Tools package was a pre-release version (2.0.0). I just downgraded to 1.1.1, and now migrations are working again. Not sure why it updated to an unstable version, but it's working now. Thanks anyway for you help!
    – dzlp
    Jun 23 '17 at 2:18















up vote
1
down vote

favorite












I have a .NET Core class library that is the data access layer for multiple web applications. I am using Entity Framework Core 1.1, but I'm having trouble with migrations through PMC. My initial migration worked successfully, but after updating the database and re-launching VS 2017 I get a null exception on the contentRootPath argument when attempting to migrate. I may have made some changes to the project after my successful migration, but I don't remember what they were. This is the error and stack trace:



Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFrameworkAdd-Migration' for Entity Framework 6.
System.ArgumentNullException: Value cannot be null.
Parameter name: contentRootPath
at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations..ctor(IOperationReporter reporter, Assembly assembly, Assembly startupAssembly, String environment, String projectDir, String contentRootPath, String rootNamespace)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<>c__DisplayClass4_0.<.ctor>b__4()
at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)


There is no config file in my migrations directory, and I can't find anything related in the DbContext class. Has anyone else ran into this issue, or know what is causing it?



SqlDbContext class:



using Microsoft.EntityFrameworkCore;
using DataLayer.Models.User;

namespace DataLayer.Context
{
public class SqlDbContext : DbContext
{
public DbSet<User> Users { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(MyDbConfig.SqlConnectionString);
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>()
.Ignore(m => m.FullName);

base.OnModelCreating(modelBuilder);
}
}
}









share|improve this question
























  • Are you using both EF6 and EFC?
    – mvermef
    Jun 22 '17 at 5:53










  • No, I am not using EF6, but it is in the project.
    – dzlp
    Jun 22 '17 at 19:03










  • I edited your tags... to only show EFC. Can you show us your references? Startup.cs and appsettings.json
    – mvermef
    Jun 22 '17 at 19:52












  • It's in a Class Library, so there is no Startup.cs or appsettings.json files. I am just storing my connection string in a static class, along with connection strings to other databases that I am accessing. I updated the code snipped with my references. And my mistake before, I meant that EF6 is in the solution, not the project.
    – dzlp
    Jun 23 '17 at 2:08












  • I just looked at my Nuget packages, and for some reason my EntityFrameworkCore.Tools package was a pre-release version (2.0.0). I just downgraded to 1.1.1, and now migrations are working again. Not sure why it updated to an unstable version, but it's working now. Thanks anyway for you help!
    – dzlp
    Jun 23 '17 at 2:18













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have a .NET Core class library that is the data access layer for multiple web applications. I am using Entity Framework Core 1.1, but I'm having trouble with migrations through PMC. My initial migration worked successfully, but after updating the database and re-launching VS 2017 I get a null exception on the contentRootPath argument when attempting to migrate. I may have made some changes to the project after my successful migration, but I don't remember what they were. This is the error and stack trace:



Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFrameworkAdd-Migration' for Entity Framework 6.
System.ArgumentNullException: Value cannot be null.
Parameter name: contentRootPath
at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations..ctor(IOperationReporter reporter, Assembly assembly, Assembly startupAssembly, String environment, String projectDir, String contentRootPath, String rootNamespace)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<>c__DisplayClass4_0.<.ctor>b__4()
at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)


There is no config file in my migrations directory, and I can't find anything related in the DbContext class. Has anyone else ran into this issue, or know what is causing it?



SqlDbContext class:



using Microsoft.EntityFrameworkCore;
using DataLayer.Models.User;

namespace DataLayer.Context
{
public class SqlDbContext : DbContext
{
public DbSet<User> Users { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(MyDbConfig.SqlConnectionString);
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>()
.Ignore(m => m.FullName);

base.OnModelCreating(modelBuilder);
}
}
}









share|improve this question















I have a .NET Core class library that is the data access layer for multiple web applications. I am using Entity Framework Core 1.1, but I'm having trouble with migrations through PMC. My initial migration worked successfully, but after updating the database and re-launching VS 2017 I get a null exception on the contentRootPath argument when attempting to migrate. I may have made some changes to the project after my successful migration, but I don't remember what they were. This is the error and stack trace:



Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFrameworkAdd-Migration' for Entity Framework 6.
System.ArgumentNullException: Value cannot be null.
Parameter name: contentRootPath
at Microsoft.EntityFrameworkCore.Utilities.Check.NotEmpty(String value, String parameterName)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations..ctor(IOperationReporter reporter, Assembly assembly, Assembly startupAssembly, String environment, String projectDir, String contentRootPath, String rootNamespace)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.<>c__DisplayClass4_0.<.ctor>b__4()
at Microsoft.EntityFrameworkCore.Internal.LazyRef`1.get_Value()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)


There is no config file in my migrations directory, and I can't find anything related in the DbContext class. Has anyone else ran into this issue, or know what is causing it?



SqlDbContext class:



using Microsoft.EntityFrameworkCore;
using DataLayer.Models.User;

namespace DataLayer.Context
{
public class SqlDbContext : DbContext
{
public DbSet<User> Users { get; set; }

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(MyDbConfig.SqlConnectionString);
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<User>()
.Ignore(m => m.FullName);

base.OnModelCreating(modelBuilder);
}
}
}






c# .net orm entity-framework-core






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 23 '17 at 2:08

























asked Jun 22 '17 at 5:06









dzlp

167




167












  • Are you using both EF6 and EFC?
    – mvermef
    Jun 22 '17 at 5:53










  • No, I am not using EF6, but it is in the project.
    – dzlp
    Jun 22 '17 at 19:03










  • I edited your tags... to only show EFC. Can you show us your references? Startup.cs and appsettings.json
    – mvermef
    Jun 22 '17 at 19:52












  • It's in a Class Library, so there is no Startup.cs or appsettings.json files. I am just storing my connection string in a static class, along with connection strings to other databases that I am accessing. I updated the code snipped with my references. And my mistake before, I meant that EF6 is in the solution, not the project.
    – dzlp
    Jun 23 '17 at 2:08












  • I just looked at my Nuget packages, and for some reason my EntityFrameworkCore.Tools package was a pre-release version (2.0.0). I just downgraded to 1.1.1, and now migrations are working again. Not sure why it updated to an unstable version, but it's working now. Thanks anyway for you help!
    – dzlp
    Jun 23 '17 at 2:18


















  • Are you using both EF6 and EFC?
    – mvermef
    Jun 22 '17 at 5:53










  • No, I am not using EF6, but it is in the project.
    – dzlp
    Jun 22 '17 at 19:03










  • I edited your tags... to only show EFC. Can you show us your references? Startup.cs and appsettings.json
    – mvermef
    Jun 22 '17 at 19:52












  • It's in a Class Library, so there is no Startup.cs or appsettings.json files. I am just storing my connection string in a static class, along with connection strings to other databases that I am accessing. I updated the code snipped with my references. And my mistake before, I meant that EF6 is in the solution, not the project.
    – dzlp
    Jun 23 '17 at 2:08












  • I just looked at my Nuget packages, and for some reason my EntityFrameworkCore.Tools package was a pre-release version (2.0.0). I just downgraded to 1.1.1, and now migrations are working again. Not sure why it updated to an unstable version, but it's working now. Thanks anyway for you help!
    – dzlp
    Jun 23 '17 at 2:18
















Are you using both EF6 and EFC?
– mvermef
Jun 22 '17 at 5:53




Are you using both EF6 and EFC?
– mvermef
Jun 22 '17 at 5:53












No, I am not using EF6, but it is in the project.
– dzlp
Jun 22 '17 at 19:03




No, I am not using EF6, but it is in the project.
– dzlp
Jun 22 '17 at 19:03












I edited your tags... to only show EFC. Can you show us your references? Startup.cs and appsettings.json
– mvermef
Jun 22 '17 at 19:52






I edited your tags... to only show EFC. Can you show us your references? Startup.cs and appsettings.json
– mvermef
Jun 22 '17 at 19:52














It's in a Class Library, so there is no Startup.cs or appsettings.json files. I am just storing my connection string in a static class, along with connection strings to other databases that I am accessing. I updated the code snipped with my references. And my mistake before, I meant that EF6 is in the solution, not the project.
– dzlp
Jun 23 '17 at 2:08






It's in a Class Library, so there is no Startup.cs or appsettings.json files. I am just storing my connection string in a static class, along with connection strings to other databases that I am accessing. I updated the code snipped with my references. And my mistake before, I meant that EF6 is in the solution, not the project.
– dzlp
Jun 23 '17 at 2:08














I just looked at my Nuget packages, and for some reason my EntityFrameworkCore.Tools package was a pre-release version (2.0.0). I just downgraded to 1.1.1, and now migrations are working again. Not sure why it updated to an unstable version, but it's working now. Thanks anyway for you help!
– dzlp
Jun 23 '17 at 2:18




I just looked at my Nuget packages, and for some reason my EntityFrameworkCore.Tools package was a pre-release version (2.0.0). I just downgraded to 1.1.1, and now migrations are working again. Not sure why it updated to an unstable version, but it's working now. Thanks anyway for you help!
– dzlp
Jun 23 '17 at 2:18












2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










It turns out that this was due to the Microsoft.EntityFrameworkCore.Tools package being pre-release version 2.0.0, which is not currently a stable version. Downgrading to 1.1.1 fixed the issue.






share|improve this answer























  • Are you sure that you do not mean 1.0.1?
    – Brian Ogden
    Sep 1 '17 at 16:55










  • Yeah, it was 1.1.1 that worked for me.
    – dzlp
    Sep 1 '17 at 16:58










  • There is no 1.1.1 version though
    – Brian Ogden
    Sep 1 '17 at 16:59










  • Oh ok, nevermind
    – Brian Ogden
    Sep 1 '17 at 16:59












  • I removed my edits
    – Brian Ogden
    Sep 1 '17 at 17:00


















up vote
1
down vote













I had this issue in the past and here is the fix:



First, make sure that the version of the SDK you are using is 2.1.200 as you are under Core 1.1 and put this on your global.json:



{
"sdk": {
"version": "2.1.200"
}
}


Add reference on your .csproj to Microsoft.EntityFrameworkCore.Design and Microsoft.EntityFrameworkCore.Tools.DotNet so you will have:



 <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design"
Version="1.1.6"
PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet"
Version="1.1.6" />
</ItemGroup>





share|improve this answer





















    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',
    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%2f44690559%2fwhy-am-i-getting-a-contentrootpath-null-exception-when-attempting-to-add-a-datab%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    It turns out that this was due to the Microsoft.EntityFrameworkCore.Tools package being pre-release version 2.0.0, which is not currently a stable version. Downgrading to 1.1.1 fixed the issue.






    share|improve this answer























    • Are you sure that you do not mean 1.0.1?
      – Brian Ogden
      Sep 1 '17 at 16:55










    • Yeah, it was 1.1.1 that worked for me.
      – dzlp
      Sep 1 '17 at 16:58










    • There is no 1.1.1 version though
      – Brian Ogden
      Sep 1 '17 at 16:59










    • Oh ok, nevermind
      – Brian Ogden
      Sep 1 '17 at 16:59












    • I removed my edits
      – Brian Ogden
      Sep 1 '17 at 17:00















    up vote
    1
    down vote



    accepted










    It turns out that this was due to the Microsoft.EntityFrameworkCore.Tools package being pre-release version 2.0.0, which is not currently a stable version. Downgrading to 1.1.1 fixed the issue.






    share|improve this answer























    • Are you sure that you do not mean 1.0.1?
      – Brian Ogden
      Sep 1 '17 at 16:55










    • Yeah, it was 1.1.1 that worked for me.
      – dzlp
      Sep 1 '17 at 16:58










    • There is no 1.1.1 version though
      – Brian Ogden
      Sep 1 '17 at 16:59










    • Oh ok, nevermind
      – Brian Ogden
      Sep 1 '17 at 16:59












    • I removed my edits
      – Brian Ogden
      Sep 1 '17 at 17:00













    up vote
    1
    down vote



    accepted







    up vote
    1
    down vote



    accepted






    It turns out that this was due to the Microsoft.EntityFrameworkCore.Tools package being pre-release version 2.0.0, which is not currently a stable version. Downgrading to 1.1.1 fixed the issue.






    share|improve this answer














    It turns out that this was due to the Microsoft.EntityFrameworkCore.Tools package being pre-release version 2.0.0, which is not currently a stable version. Downgrading to 1.1.1 fixed the issue.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Sep 1 '17 at 16:59









    Brian Ogden

    10.4k457110




    10.4k457110










    answered Jun 23 '17 at 2:20









    dzlp

    167




    167












    • Are you sure that you do not mean 1.0.1?
      – Brian Ogden
      Sep 1 '17 at 16:55










    • Yeah, it was 1.1.1 that worked for me.
      – dzlp
      Sep 1 '17 at 16:58










    • There is no 1.1.1 version though
      – Brian Ogden
      Sep 1 '17 at 16:59










    • Oh ok, nevermind
      – Brian Ogden
      Sep 1 '17 at 16:59












    • I removed my edits
      – Brian Ogden
      Sep 1 '17 at 17:00


















    • Are you sure that you do not mean 1.0.1?
      – Brian Ogden
      Sep 1 '17 at 16:55










    • Yeah, it was 1.1.1 that worked for me.
      – dzlp
      Sep 1 '17 at 16:58










    • There is no 1.1.1 version though
      – Brian Ogden
      Sep 1 '17 at 16:59










    • Oh ok, nevermind
      – Brian Ogden
      Sep 1 '17 at 16:59












    • I removed my edits
      – Brian Ogden
      Sep 1 '17 at 17:00
















    Are you sure that you do not mean 1.0.1?
    – Brian Ogden
    Sep 1 '17 at 16:55




    Are you sure that you do not mean 1.0.1?
    – Brian Ogden
    Sep 1 '17 at 16:55












    Yeah, it was 1.1.1 that worked for me.
    – dzlp
    Sep 1 '17 at 16:58




    Yeah, it was 1.1.1 that worked for me.
    – dzlp
    Sep 1 '17 at 16:58












    There is no 1.1.1 version though
    – Brian Ogden
    Sep 1 '17 at 16:59




    There is no 1.1.1 version though
    – Brian Ogden
    Sep 1 '17 at 16:59












    Oh ok, nevermind
    – Brian Ogden
    Sep 1 '17 at 16:59






    Oh ok, nevermind
    – Brian Ogden
    Sep 1 '17 at 16:59














    I removed my edits
    – Brian Ogden
    Sep 1 '17 at 17:00




    I removed my edits
    – Brian Ogden
    Sep 1 '17 at 17:00












    up vote
    1
    down vote













    I had this issue in the past and here is the fix:



    First, make sure that the version of the SDK you are using is 2.1.200 as you are under Core 1.1 and put this on your global.json:



    {
    "sdk": {
    "version": "2.1.200"
    }
    }


    Add reference on your .csproj to Microsoft.EntityFrameworkCore.Design and Microsoft.EntityFrameworkCore.Tools.DotNet so you will have:



     <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design"
    Version="1.1.6"
    PrivateAssets="All" />
    </ItemGroup>
    <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet"
    Version="1.1.6" />
    </ItemGroup>





    share|improve this answer

























      up vote
      1
      down vote













      I had this issue in the past and here is the fix:



      First, make sure that the version of the SDK you are using is 2.1.200 as you are under Core 1.1 and put this on your global.json:



      {
      "sdk": {
      "version": "2.1.200"
      }
      }


      Add reference on your .csproj to Microsoft.EntityFrameworkCore.Design and Microsoft.EntityFrameworkCore.Tools.DotNet so you will have:



       <ItemGroup>
      <PackageReference Include="Microsoft.EntityFrameworkCore.Design"
      Version="1.1.6"
      PrivateAssets="All" />
      </ItemGroup>
      <ItemGroup>
      <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet"
      Version="1.1.6" />
      </ItemGroup>





      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        I had this issue in the past and here is the fix:



        First, make sure that the version of the SDK you are using is 2.1.200 as you are under Core 1.1 and put this on your global.json:



        {
        "sdk": {
        "version": "2.1.200"
        }
        }


        Add reference on your .csproj to Microsoft.EntityFrameworkCore.Design and Microsoft.EntityFrameworkCore.Tools.DotNet so you will have:



         <ItemGroup>
        <PackageReference Include="Microsoft.EntityFrameworkCore.Design"
        Version="1.1.6"
        PrivateAssets="All" />
        </ItemGroup>
        <ItemGroup>
        <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet"
        Version="1.1.6" />
        </ItemGroup>





        share|improve this answer












        I had this issue in the past and here is the fix:



        First, make sure that the version of the SDK you are using is 2.1.200 as you are under Core 1.1 and put this on your global.json:



        {
        "sdk": {
        "version": "2.1.200"
        }
        }


        Add reference on your .csproj to Microsoft.EntityFrameworkCore.Design and Microsoft.EntityFrameworkCore.Tools.DotNet so you will have:



         <ItemGroup>
        <PackageReference Include="Microsoft.EntityFrameworkCore.Design"
        Version="1.1.6"
        PrivateAssets="All" />
        </ItemGroup>
        <ItemGroup>
        <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet"
        Version="1.1.6" />
        </ItemGroup>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 at 20:52









        YManaf

        111




        111






























            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2f44690559%2fwhy-am-i-getting-a-contentrootpath-null-exception-when-attempting-to-add-a-datab%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

            Berounka

            Sphinx de Gizeh

            Different font size/position of beamer's navigation symbols template's content depending on regular/plain...