templating: dotnet new -i not reporting errors and exclusions not working as expected

Doing some work on this PR at the moment. https://github.com/eShopWorld/template-webapi-fabric/pull/23

On my final test to install the template it just bombs out with no errors:

nuget pack C:\[path]\template-webapi-fabric\src\Eshopworld.WebAPIFabric.Template.nuspec

create new dir, navigate to it and run

dotnet new -i C:\[path]\template-webapi-fabric\src\Eshopworld.WebAPIFabric.Template.1.0.8.nupkg

The previous version does work as expected ie: 1.0.7. This is what is also in the master branch and creating this template on my machine runs just fine.

After you check what has been installed with 1.0.8 you are left with just the standard set of templates as outlined here:

Templates                                         Short Name         Language          Tags
----------------------------------------------------------------------------------------------------------------------------
Console Application                               console            [C#], F#, VB      Common/Console
Class library                                     classlib           [C#], F#, VB      Common/Library
Unit Test Project                                 mstest             [C#], F#, VB      Test/MSTest
NUnit 3 Test Project                              nunit              [C#], F#, VB      Test/NUnit
NUnit 3 Test Item                                 nunit-test         [C#], F#, VB      Test/NUnit
xUnit Test Project                                xunit              [C#], F#, VB      Test/xUnit
Razor Page                                        page               [C#]              Web/ASP.NET
MVC ViewImports                                   viewimports        [C#]              Web/ASP.NET
MVC ViewStart                                     viewstart          [C#]              Web/ASP.NET
ASP.NET Core Empty                                web                [C#], F#          Web/Empty
ASP.NET Core Web App (Model-View-Controller)      mvc                [C#], F#          Web/MVC
ASP.NET Core Web App                              webapp             [C#]              Web/MVC/Razor Pages
ASP.NET Core with Angular                         angular            [C#]              Web/MVC/SPA
ASP.NET Core with React.js                        react              [C#]              Web/MVC/SPA
ASP.NET Core with React.js and Redux              reactredux         [C#]              Web/MVC/SPA
Razor Class Library                               razorclasslib      [C#]              Web/Razor/Library/Razor Class Library
ASP.NET Core Web API                              webapi             [C#], F#          Web/WebAPI
global.json file                                  globaljson                           Config
NuGet Config                                      nugetconfig                          Config
Web Config                                        webconfig                            Config
Solution File                                     sln                                  Solution

Examples:
    dotnet new mvc --auth Individual
    dotnet new xunit
    dotnet new --help

Additionally, the exclusions within the https://github.com/eShopWorld/template-webapi-fabric/blob/bc04a29e681554861ccf35d287fc1c1702bbe883/src/.template.config/template.json do not seem to work as expected. I’ve tried a few varieties of options here and played them within the modifiers array as suggested here https://github.com/dotnet/templating/issues/850 but to no avail.

Any help on both issues would be appreciated.

Thanks Dave

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 19 (6 by maintainers)

Most upvoted comments

Above was implemented and merged to main branch, only list of installed templates is shown to users now, closing.

The issue will be fixed with https://github.com/dotnet/templating/issues/2745, when implementing that epic install-uninstall was majorly reworked.

The error messages and the result of installation will be now shown to user. If installation was not successful, the error and the reason will be shown to user.

Draft example:

> dotnet  new  -i Take.Blip.Client.Templates::0.50.10 --nuget-source https://api.nuget.org/v3/index.json
The following template sources will be installed:
  Take.Blip.Client.Templates, version: 0.50.10

Warning: Take.Blip.Client.Templates::0.50.10 is not found in NuGet feeds https://api.nuget.org/v3/index.json.
'Take.Blip.Client.Templates::0.50.10' could not be installed, the package does not exist.

If installation was successful, the list of installed templates will be shown to user:

dotnet new3 -i Microsoft.Azure.WebJobs.ItemTemplates
The following sources will be installed:
  Microsoft.Azure.WebJobs.ItemTemplates

The template source Microsoft.Azure.WebJobs.ItemTemplates::3.1.1648 was successfully installed.
The following templates were installed:
Template Name                  Short Name  Language  Tags
-----------------------------  ----------  --------  ----------------------------------------------
DurableFunctionsOrchestration  durable     [C#]      Azure Function/Durable Functions Orchestration
SendGrid                       sendgrid    [C#]      Azure Function/Ouput/SendGrid
BlobTrigger                    blob        [C#],F#   Azure Function/Trigger/Blob
CosmosDBTrigger                cosmos      [C#],F#   Azure Function/Trigger/Cosmos DB
EventGridTrigger               eventgrid   [C#]      Azure Function/Trigger/EventGrid
EventHubTrigger                eventhub    [C#],F#   Azure Function/Trigger/EventHub
HttpTrigger                    http        [C#],F#   Azure Function/Trigger/Http
SignalRTrigger                 signalr     [C#]      Azure Function/Trigger/Http/SignalR
IotHubTrigger                  iothub      [C#]      Azure Function/Trigger/IotHub
RabbitMQTrigger                rqueue      [C#]      Azure Function/Trigger/RabbitMQ Queue
ServiceBusQueueTrigger         squeue      [C#]      Azure Function/Trigger/Service Bus/Queue
ServiceBusTopicTrigger         stopic      [C#]      Azure Function/Trigger/Service Bus/Topic
QueueTrigger                   queue       [C#]      Azure Function/Trigger/Storage Queue
TimerTrigger                   timer       [C#],F#   Azure Function/Trigger/Timer

no that doesn’t matter, it’s not installing the template from nuget package on disk:

Unable to determine the desired template from the input template name: mini-scaffold.