.netgitazure-devopsdotnet-new

Git Azure DevOps URL Not Supported Error When Running dotnet new -i <Azure DevOps Repo URL> (Even with PAT)


Problem:

I'm trying to install a custom template using the dotnet new -i command <Azure DevOps Repo URL> from a private Azure DevOps Git repository, but I’m encountering the error: 'url' is not supported

but when i try to clone the same repo i don't encounter any problem.

What am I missing? How can I fix this issue and properly install the template from my Azure DevOps repository using dotnet new?


Solution

  • The error you're encountering is because the dotnet new -i command does not support installing templates directly from a URL.

    According to dotnet new install,

    The dotnet new install command installs a template package from the PATH or NUGET_ID provided.

    To install a custom template from your Azure DevOps repository, you can follow these steps:

    1. Clone the repository locally by running git clone <Azure DevOps Repo URL>.
    2. Navigate to the template directory or copy the template to your target directory.
    3. Install the template from the local directory. dotnet new install .