dotnet core PackageReference vs DotNetCliToolReference

前端 未结 1 1080
醉话见心
醉话见心 2020-12-30 05:07

I\'m trying to run dotnet aspnet-codegenerator from my comand line. The first time I tried, I got the error No executable found matching command \"dotnet-

相关标签:
1条回答
  • 2020-12-30 05:35
    1. At the moment adding DotNetCliToolReference items is only possibly by hand-editing the csproj file, there is a feature request for a CLI command at https://github.com/NuGet/Home/issues/4901

    2. The logical difference is that PackageReferences will become part of your application - you can use the dlls shipped with the package from your code and it will be deployed with your app. DotNetCliToolReference packages will be restored from feeds but not added to your app's "dependency graph". When the CLI runs commands it looks at the csproj file as well to resolve command names to the corresponding dll files through DotNetCliToolReference items.

    3. It does not matter in which item groups those two item types are. MSBuild is very dynamic and you can re-arrange the file as you like. Both the CLI and NuGet use MSBuild API to evaluate the file and query the project's items.

    4. The error you are seeing that dotnet add package fails when a DotNetCliToolReference is already present is a bug that has been fixed for the upcoming 2.0 release: https://github.com/NuGet/Home/issues/4771

    0 讨论(0)
提交回复
热议问题