aspnet/Announcements

dotnet-watch, dotnet-ef, and dotnet-user-secrets will move into the .NET Core CLI in 2.1.300

natemcmaster opened this issue · 2 comments

Starting in .NET Core CLI 2.1.300-preview2, the following tools were added as bundled, top-level commands. These tools previously shipped as NuGet packages.

  • Microsoft.DotNet.Watcher.Tools (aka dotnet-watch)
  • Microsoft.EntityFrameworkCore.Tools.DotNet (aka dotnet-ef)
  • Microsoft.Extensions.SecretManager.Tools (aka dotnet-user-secrets)
  • Microsoft.Extensions.Caching.SqlConfig.Tools (aka dotnet-sql-cache)

Commands like dotnet watch, dotnet ef, and dotnet user-secrets can be executed on any project without needing to install the command via "dotnet restore" or "dotnet install tool". The commands are available by default in all projects.

Upgrading from stable releases of .NET Core CLI (e.g. 2.1.5)

Using these tools as a DotNetCliToolReference will no longer work. If your .csproj file has the following lines, they can be removed.

<ItemGroup>
   <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="(all versions)" />
   <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="(all versions)" />
   <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="(all versions)" />
   <DotNetCliToolReference Include="Microsoft.Extensions.Caching.SqlConfig.Tools" Version="(all versions)" />
</ItemGroup>

Upgrading from .NET Core CLI 2.1.300-preview1

For early-adopters who tried the 2.1.300-preview1 release, you will no longer need to run dotnet install tool -g to acquire the following tools:

  • dotnet-watch
  • dotnet-user-secrets
  • dotnet-dev-certs
  • dotnet-sql-cache
  • dotnet-ef

If you had installed these tools in 2.1.300-preview1, you can uninstall them manually by deleting corresponding files from %USERPROFILE%\.dotnet\tools\ (Windows) or $HOME/.dotnet/tools (macOS/Linux).

For discussion use aspnet/DotNetTools#399

Cool, but installing them (which feels intuitive but isn't needed) shouldn't crash. What's a friendly message to solve this?

95→ C:\github\hanselminutes-core [master ≡ +0 ~0 -1 !]> dotnet install tool Microsoft.Dotnet.Watcher.Tools -g
Install failed. Failed to download package:
NuGet returned:

Failed to restore package.
WorkingDirectory:
Arguments: restore C:\Users\scott\AppData\Local\Temp\gnzjrzwo.bvk\nh3id1v4.onz.csproj --runtime win10-x64 /p:BaseIntermediateOutputPath=\"C:\Users\scott\.dotnet\toolspkgs\Microsoft.Dotnet.Watcher.Tools\2gtgbll5.42m\"
Output:   Restoring packages for C:\Users\scott\AppData\Local\Temp\gnzjrzwo.bvk\nh3id1v4.onz.csproj...
  Installing Microsoft.NETCore.DotNetAppHost 2.0.0.
  Installing Microsoft.NETCore.DotNetHostResolver 2.0.0.
  Installing NETStandard.Library 2.0.0.
  Installing Microsoft.NETCore.Platforms 2.0.0.
  Installing Microsoft.NETCore.DotNetHostPolicy 2.0.0.
  Installing Microsoft.NETCore.App 2.0.0.
  Installing Microsoft.DotNet.Watcher.Tools 2.0.0.
  Installing runtime.win-x64.Microsoft.NETCore.DotNetAppHost 2.0.0.
  Installing runtime.win-x64.Microsoft.NETCore.DotNetHostResolver 2.0.0.
  Installing runtime.win-x64.Microsoft.NETCore.DotNetHostPolicy 2.0.0.
  Installing runtime.win-x64.Microsoft.NETCore.App 2.0.0.
C:\Users\scott\AppData\Local\Temp\gnzjrzwo.bvk\nh3id1v4.onz.csproj : error NU1212: Invalid project-package combination for Microsoft.DotNet.Watcher.Tools 2.0.0. DotnetToolReference project style can only contain references of the DotnetTool type
  Restore failed in 5.89 sec for C:\Users\scott\AppData\Local\Temp\gnzjrzwo.bvk\nh3id1v4.onz.csproj.



[Nate] You've hit this issue https://github.com/dotnet/cli/issues/8698. Please use aspnet/DotNetTools#399 for discussion.

Updated to include instructions for dotnet-ef.