Search code examples
azurenuget

Nuget package install using Azure App service editor


My application is hosted on Azure and I using the App Service editor to do my changes and build on the cloud itself without using Visual Studio locally.

Now I would like to install a Nuget package to the project. So I tried the console option from the App Service editor. But it does not work as the console window does not recognize Nuget commands.

enter image description here

So after looking through the help command on App Service editor console I found these options-

    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

So there seems to be nuget command but when I use it the console window is just stuck and stays like that.

enter image description here

Am I using the command correctly or there seems to be some problem? I know I can download and do this locally but I am looking for a way to do this simply using the App Service editor. Any help on this please?


Solution

  • Try

    dotnet add package RestSharp --version 106.2.2
    

    You could check:

    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.