SiberianGuy
SiberianGuy

Reputation: 25302

Where Project.json tools should go now?

I'm following Entity Framework Core instructions step by step. At some point it says to

locate the tools section and add the Microsoft.EntityFrameworkCore.Tools.DotNet package as shown below

project.json:

"tools": {
   "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final",
   "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
   "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
 },

As I understand, project.json is gone now. So where am I supposed to add this value? Project file?

Upvotes: 4

Views: 874

Answers (2)

SiberianGuy
SiberianGuy

Reputation: 25302

I found an answer in Announcing Entity Framework Core 1.1:

If you are using the new .NET Core Tools MSBuild Alpha in Visual Studio 2017 RC, the tooling story is more complicated. This is a point in time issue and will be resolved as the .NET Core Tools MSBuild support stabilizes.

At this stage, you should use the Package Manager Console commands in Visual Studio (Add-Migration, Update-Database, Scaffold-DbContext, etc.). The .NET Core CLI commands (dotnet ef) do not currently work with the .NET Core Tools MSBuild Alpha.

Long story short: it is not supported yet.

Upvotes: 0

omajid
omajid

Reputation: 15203

In the project.json/xproj format, it goes at the top-level in project.json: https://learn.microsoft.com/en-us/dotnet/articles/core/tools/project-json#tools

In the new csproj system, it's represented by DotNetCliToolReference. There's basically no documentation for this that I could find; I only found it by reading the source of dotnet-migrate.

An example of that looks like this:

<Project ...>
  <Import .../>
  <PropertyGroup .../>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet">
      <Version>1.0.0</Version>
    </DotNetCliToolReference>
  </ItemGroup>
</Project>

A more complete example of the output of dotnet-migrate is here.

Upvotes: 6

Related Questions