Andrew Makarov
Andrew Makarov

Reputation: 71

How can I specify my nuget server for the ‘dotnet new-I name_custom_template’ command?

I have a following problem: my custom template is on my nuget server( not an official nuget.org server).

I could not find any information about specifying the source of nuget package. For example, as it is implemented in dotnet restore -s my-custom-server.org command, where parameter -s, you can pass the source of nuget package, and the packages will be taken from this source.

How can I do the same with command dotnet new -i my_custom_template? In manual on microsoft site, it is written that you can pass physical path to the file(package) or ID of package on nuget.org server.

Upvotes: 3

Views: 1014

Answers (1)

thor
thor

Reputation: 171

According to the command documentation, there is the --nuget-source parameter, allowing to define a custom source.

For example the following command, installs the Fable-Elmish-React template from nuget.org given as an explicit Parameter. This concrete command worked for me overloading the default nuget feed, which wasn't nuget.org in my case.

By adapting the given feed here, you should be able to use any other feed.

dotnet new -i "Fable.Template.Elmish.React::*" --nuget-source https://api.nuget.org/v3/index.json

Upvotes: 3

Related Questions