Powershell 你能赢得比赛吗

Powershell 你能赢得比赛吗,powershell,nuget,nuget-package,Powershell,Nuget,Nuget Package,环境:Macos上的Powershell 7 我正在尝试安装软件包: install-Package Grpc.Net.Client 它“永远”挂起,所以我尝试安装 Install-Package Google.Protobuf 然后,他提出: Install-Package: Unable to find dependent package(s) (System.Reflection) WARNING: 'System.Reflection' matched package 'S

环境:Macos上的Powershell 7

我正在尝试安装软件包:

install-Package Grpc.Net.Client    
它“永远”挂起,所以我尝试安装

Install-Package Google.Protobuf
然后,他提出:

Install-Package: Unable to find dependent package(s) (System.Reflection)
WARNING: 'System.Reflection' matched package 'System.Reflection/4.3.0' from provider: 'NuGet', source 'System.Reflection'.
WARNING: 'System.Reflection' matched package 'System.Reflection/4.1.0' from provider: 'NuGet', source 'nuget.org'.
Install-Package: Unable to install, multiple packages matched 'System.Reflection'. Please specify a single -Source.
The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'nuget.org'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): 
好的,然后我尝试安装:

Install-Package System.Reflection                                                                                              
然后它得出:

Install-Package: Unable to find dependent package(s) (System.Reflection)
WARNING: 'System.Reflection' matched package 'System.Reflection/4.3.0' from provider: 'NuGet', source 'System.Reflection'.
WARNING: 'System.Reflection' matched package 'System.Reflection/4.1.0' from provider: 'NuGet', source 'nuget.org'.
Install-Package: Unable to install, multiple packages matched 'System.Reflection'. Please specify a single -Source.
The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'nuget.org'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): 
然后我尝试:

 Install-Package System.Reflection -Source nuget.org
Register-PackageSource -Name System.Reflection -Provider Nuget
然后它得出:

Install-Package: Unable to find dependent package(s) (System.Reflection)
WARNING: 'System.Reflection' matched package 'System.Reflection/4.3.0' from provider: 'NuGet', source 'System.Reflection'.
WARNING: 'System.Reflection' matched package 'System.Reflection/4.1.0' from provider: 'NuGet', source 'nuget.org'.
Install-Package: Unable to install, multiple packages matched 'System.Reflection'. Please specify a single -Source.
The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'nuget.org'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): 
然后我尝试:

 Install-Package System.Reflection -Source nuget.org
Register-PackageSource -Name System.Reflection -Provider Nuget
然后我得到:

Register-PackageSource: Package Source 'System.Reflection' exists.
然后我试着

Well, I really dont know how this packagemanager can help me?

tl;dr:使用
dotnet添加包Grpc.Net.Client
,或者Visual Studio for Mac中存在的任何NuGet功能,如果您使用的话

较长版本:表示:

本主题介绍Windows上Visual Studio中包管理器控制台中的命令。有关通用PowerShell安装包命令,请参阅PowerShell PackageManagement参考

没有定义或链接到他们所认为的“软件包”,但是,我的理解是PosikSub包向PooS壳添加新的PosiS壳命令。 因此,Powershell的

安装包
不用于将NuGet软件包安装到.NET项目中,但Powershell模块可以作为NuGet软件包分发。NuGet的
安装包
仅在Windows上的Visual Studio中可用。这是一个非常不幸的名字冲突,如果不打破很多人的话,它是无法修复的,所以坦率地说,我无法想象它会被改变

您链接到的GRPC示例可能没有足够清楚地表明powershell命令仅在Visual Studio for Windows中工作。我能看到的对powershell的唯一引用是代码块上方的一个小标题,上面说代码块的内容是powershell,但关于代码块的说明明确指出要选择我认为仅存在于Visual Studio for Windows中的菜单

许多Microsoft文档页面的底部都有注释部分,但不幸的是,您链接的示例没有注释部分,因此我将代表您提出一个问题,请文档维护人员对其进行改进


如tl中所述;在顶部,如果您的项目是SDK样式的项目,您可以使用dotnet CLI向您的项目中添加一个包:
dotnet add package

谢谢,“dotnet add package”可能是我选择的方式go@ChrisG. 我想我在另一个URL上找到了相同的教程,这次是针对VSCode和Visual Studio for Mac用户的说明:只需添加到这个。Visual Studio for Mac提供了一个NuGet软件包管理器控制台,但这是一个需要安装的单独扩展,或者您可以使用Visual Studio for Mac的内置NuGet支持。但是,如果您没有使用Visual Studio for Mac,则
dotnet添加包
nuget安装
将是您的最佳选择。