使用 Azure 应用服务编辑器安装 Nuget 包

问题描述 投票:0回答:2

我的应用程序托管在 Azure 上,我使用应用服务编辑器进行更改并在云本身上进行构建,而无需在本地使用 Visual Studio。

现在我想将 Nuget 包安装到项目中。因此,我尝试了应用服务编辑器中的控制台选项。但它不起作用,因为控制台窗口无法识别 Nuget 命令。

enter image description here

因此,在查看应用服务编辑器控制台上的帮助命令后,我找到了这些选项 -

    cd              Directory navigation
    copy
    del
    dir
    exit            Closes the console
    git             Git source control commanding
    help            List of available commands
    mkdir
    move
    msbuild         MSBuild commanding
    node            Node.js commanding
    npm             Node package manager
    nuget           NuGet commanding
    open            Open file in editor
    ps              PowerShell commanding
    rd
    rename
    rmdir
    touch           Touch a file if it exists or create it otherwise
    unzip           Unzip archives

Native windows commands (append /? for help):
    copy            Copy files
    del             Delete a file
    move            Move files
    rename          Rename files
    dir             Directory browsing
    mkdir           Create a directory
    rmdir           Delete a directory

所以似乎有 nuget 命令,但当我使用它时,控制台窗口就卡住了并保持这样。

enter image description here

我使用的命令正确还是似乎有问题? 我知道我可以在本地下载并执行此操作,但我正在寻找一种只需使用应用服务编辑器即可执行此操作的方法。请问有什么帮助吗?

azure nuget
2个回答
1
投票

尝试

dotnet add package RestSharp --version 106.2.2

您可以检查:

Usage: dotnet add <PROJECT> package [options] <PACKAGE_NAME>

Arguments:
  <PROJECT>        The project file to operate on. If a file is not specified, the command will search the current directory for one.
  <PACKAGE_NAME>   The package reference to add.

Options:
  -h, --help                                Show help information.
  -v, --version <VERSION>                   Version for the package to be added.
  -f, --framework <FRAMEWORK>               Adds reference only when targeting a specific framework.
  -n, --no-restore                          Adds reference without performing restore preview and compatibility check.
  -s, --source <SOURCE>                     Specifies NuGet package sources to use during the restore.
  --package-directory <PACKAGE_DIRECTORY>   Restores the packages to the specified directory.

0
投票

或者,您也可以在 AzureDevops 中进行 nuget 推送时提及 PUT url PUT https://pkgs.dev.azure.com//_packaging//nuget// 在项目中的 nuget.config 中,它可能与通常的 index.json 不同,但类似于下面的管道代码

  • 任务:NuGetCommand@2 输入: 命令:“恢复” 恢复解决方案:'**/.sln' feedsToUse:“选择” vstsFeed:'>' 这不需要提供任何凭据,从而避免将此配置绑定到特定用户。
© www.soinside.com 2019 - 2024. All rights reserved.