简体   繁体   English

如何在 Visual Studio 外使用包管理器控制台 powershell

[英]How to use Package Manager Console powershell outside visual studio

I have a powershell script which has nuget commands like:我有一个具有 nuget 命令的 powershell 脚本,例如:

Get-Project -All获取项目 - 全部

Get-Package -ProjectName获取包 -ProjectName

When I run package manager console on visual studio like:当我在 Visual Studio 上运行包管理器控制台时:

PM> .\\download-packages-license.ps1 PM> .\\download-packages-license.ps1

It worked but I cannot run powershell.它有效,但我无法运行 powershell。 I need a hlp.我需要一个帮助。

Powershell error message: Powershell 错误消息:

download-packages-license.ps1 cannot be loaded because running scripts is disabled on this system. download-packages-license.ps1 无法加载,因为在此系统上禁用了运行脚本。 For more information, see about_Execution_Policies at https:/go.microsoft.com/ fwlink/?LinkID=135170.有关详细信息,请参阅 https://go.microsoft.com/fwlink/?LinkID=135170 上的 about_Execution_Policies。 At line:1 char:1 + .\\download-packages-license.ps1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess在 line:1 char:1 + .\\download-packages-license.ps1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException +fullyQualifiedErrorId : UnauthorizedAccess

How to use Package Manager Console powershell outside visual studio如何在 Visual Studio 外使用包管理器控制台 powershell

I am afraid you could not use Package Manager Console powershell outside visual studio.恐怕您无法在 Visual Studio 之外使用包管理器控制台 powershell。 That because package manager console is providing is access to visual studio objects :那是因为包管理器控制台提供的是对Visual Studio 对象的访问:

https://github.com/NuGet/Home/issues/1512 https://github.com/NuGet/Home/issues/1512

So, if you want use Package Manager Console powershell outside visual studio, we have to parse the .csproj file or .sln solution file with powershell manually, like:因此,如果您想在 Visual Studio 之外使用 Package Manager Console powershell,我们必须手动使用 powershell 解析.csproj文件或.sln解决方案文件,例如:

How do I programmatically list all projects in a solution? 如何以编程方式列出解决方案中的所有项目?

Hope this helps.希望这可以帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Visual Studio 中配置包管理器控制台使用的 powershell 版本? - how to configure the powershell version used by the package manager console in visual studio? 在扩展中以编程方式访问visual studio的powershell控制台(包管理器控制台) - Access the powershell console (package manager console) of visual studio programmatically in an extension Powershell包含在Visual Studio中的程序包管理器控制台中的项目中 - Powershell Include In Project From Package Manager Console In Visual Studio 如何确定在Powershell的Visual Studio程序包管理器控制台中选择的默认项目? - How do I determine the default project selected in the Visual Studio Package Manager Console in Powershell? 如何在Visual Studio外部使用nuget包管理器从命令行安装/更新包? - How can I use the nuget Package Manager outside Visual Studio to install/update a package from the commandline? 如何在Visual Studio中更改程序包管理器控制台的字体大小 - How to change Font Size of Package Manager Console in Visual Studio 如何在Visual Studio 2013中自动化Package Manager控制台 - How to automate Package Manager Console in Visual Studio 2013 Visual Studio 包管理器控制台的键盘快捷键? - Keyboard Shortcut for the Visual Studio Package Manager Console? 如何在 Visual Studio package 管理器中隐藏 package - How to hide a package in Visual Studio package manager 无法在虚拟机中运行的 Visual Studio 2019 中使用 package 管理器控制台 - Unable to use package manager console in visual studio 2019 that running inside Virtual Machine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM