2

I am getting following strange exceptions.

I already saw following thread discussing about downgrading Microsoft.EntityFrameworkCore.Tools to 1.1.1 which I already did, but still these exceptions are appearing.

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) 

Can any body help in this regard.

1

2 Answers 2

2

Just to note in retrospect that I got this error while trying to run a dotnet CLI command. The problem I found was that the CLI environment was defaulting to use the .NET Core 2.0 version of the dotnet and ef commands but I needed to use the .NET Core 1.1 version because that was what the package versions were built against.

I discovered (by running dotnet --info) that there was more than one version of .NET Core SDK installed on the environment and the Path pointed to the latest by default. To use the older version I added a global.json file in the solution root with the specific version number. e.g.

{ "sdk": { "version": "1.1.11" } } 

and everything worked.

Sign up to request clarification or add additional context in comments.

1 Comment

My version was 2.0.0, differs with sdks installed I think.
0

Make sure all your versions align.

<ItemGroup> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.5" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.5" /> </ItemGroup> <ItemGroup> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.1.5" /> </ItemGroup> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.