Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.32k stars 434 forks source link

creating new function doesn't work as expected #589

Closed krancour closed 6 years ago

krancour commented 6 years ago

Context:

OS: Mac OS 10.13.4

$ dotnet --version
2.1.302
$ func --version
2.0.1-beta.32

When I try to create a new function, no directory is created for the function, even though the command appears to exit 0.

Also worth noting are two apparent errors in the output containing "Could not find something to uninstall called ..."

Usage also seems to be printed erroneously. (Probably a separate issue?) See #588

$ func new
Select a template: 
1. QueueTrigger
2. HttpTrigger
3. BlobTrigger
4. TimerTrigger
5. DurableFunctionsOrchestration
6. SendGrid
7. EventHubTrigger
8. ServiceBusQueueTrigger
9. ServiceBusTopicTrigger
10. EventGridTrigger
11. IotHubTrigger
Choose option: 2
Function name: foo
foo
Usage: new [options]

Options:
  -h, --help          Displays help for this command.
  -l, --list          Lists templates containing the specified name. If no name is specified, lists all templates.
  -n, --name          The name for the output being created. If no name is specified, the name of the current directory is used.
  -o, --output        Location to place the generated output.
  -i, --install       Installs a source or a template pack.
  -u, --uninstall     Uninstalls a source or a template pack.
  --nuget-source      Specifies a NuGet source to use during install.
  --type              Filters templates based on available types. Predefined values are "project", "item" or "other".
  --force             Forces content to be generated even if it would change existing files.
  -lang, --language   Filters templates based on language and specifies the language of the template to create.

Templates                                         Short Name                          Language          Tags                                 
---------------------------------------------------------------------------------------------------------------------------------------------
QueueTrigger                                      Queue                               [C#]              Azure Function                       
HttpTrigger                                       Http                                [C#]              Azure Function                       
BlobTrigger                                       Blob                                [C#]              Azure Function                       
TimerTrigger                                      Timer                               [C#]              Azure Function                       
DurableFunctionsOrchestration                     DurableFunctionsOrchestration       [C#]              Azure Function                       
SendGrid                                          SendGrid                            [C#]              Azure Function                       
EventHubTrigger                                   EventHub                            [C#]              Azure Function                       
ServiceBusQueueTrigger                            SBQueue                             [C#]              Azure Function                       
ServiceBusTopicTrigger                            SBTopic                             [C#]              Azure Function                       
EventGridTrigger                                  EventGrid                           [C#]              Azure Function                       
IotHubTrigger                                     IotHub                              [C#]              Azure Function                       
CosmosDBTrigger                                   CosmosDB                            [C#]              Azure Function                       
Azure Functions                                   azureFunctionsProjectTemplates      [C#], F#          AzureFunctions/ClassLib              
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                          
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                              razor                               [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 mstest 
    dotnet new --help
Usage: new [options]

Options:
  -h, --help          Displays help for this command.
  -l, --list          Lists templates containing the specified name. If no name is specified, lists all templates.
  -n, --name          The name for the output being created. If no name is specified, the name of the current directory is used.
  -o, --output        Location to place the generated output.
  -i, --install       Installs a source or a template pack.
  -u, --uninstall     Uninstalls a source or a template pack.
  --nuget-source      Specifies a NuGet source to use during install.
  --type              Filters templates based on available types. Predefined values are "project", "item" or "other".
  --force             Forces content to be generated even if it would change existing files.
  -lang, --language   Filters templates based on language and specifies the language of the template to create.

Templates                                         Short Name                          Language          Tags                                 
---------------------------------------------------------------------------------------------------------------------------------------------
QueueTrigger                                      Queue                               [C#]              Azure Function                       
HttpTrigger                                       Http                                [C#]              Azure Function                       
BlobTrigger                                       Blob                                [C#]              Azure Function                       
TimerTrigger                                      Timer                               [C#]              Azure Function                       
DurableFunctionsOrchestration                     DurableFunctionsOrchestration       [C#]              Azure Function                       
SendGrid                                          SendGrid                            [C#]              Azure Function                       
EventHubTrigger                                   EventHub                            [C#]              Azure Function                       
ServiceBusQueueTrigger                            SBQueue                             [C#]              Azure Function                       
ServiceBusTopicTrigger                            SBTopic                             [C#]              Azure Function                       
EventGridTrigger                                  EventGrid                           [C#]              Azure Function                       
IotHubTrigger                                     IotHub                              [C#]              Azure Function                       
CosmosDBTrigger                                   CosmosDB                            [C#]              Azure Function                       
Azure Functions                                   azureFunctionsProjectTemplates      [C#], F#          AzureFunctions/ClassLib              
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                          
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                              razor                               [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 nugetconfig
    dotnet new --help
The template "HttpTrigger" was created successfully.

Processing post-creation actions...
Description: Opens the function class file in the editor
Manual instructions: 

Could not find something to uninstall called '/usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.32/templates/itemTemplates.nupkg'.
Usage: new [options]

Options:
  -h, --help          Displays help for this command.
  -l, --list          Lists templates containing the specified name. If no name is specified, lists all templates.
  -n, --name          The name for the output being created. If no name is specified, the name of the current directory is used.
  -o, --output        Location to place the generated output.
  -i, --install       Installs a source or a template pack.
  -u, --uninstall     Uninstalls a source or a template pack.
  --nuget-source      Specifies a NuGet source to use during install.
  --type              Filters templates based on available types. Predefined values are "project", "item" or "other".
  --force             Forces content to be generated even if it would change existing files.
  -lang, --language   Filters templates based on language and specifies the language of the template to create.

Templates                                         Short Name                          Language          Tags                                 
---------------------------------------------------------------------------------------------------------------------------------------------
QueueTrigger                                      Queue                               [C#]              Azure Function                       
HttpTrigger                                       Http                                [C#]              Azure Function                       
BlobTrigger                                       Blob                                [C#]              Azure Function                       
TimerTrigger                                      Timer                               [C#]              Azure Function                       
DurableFunctionsOrchestration                     DurableFunctionsOrchestration       [C#]              Azure Function                       
SendGrid                                          SendGrid                            [C#]              Azure Function                       
EventHubTrigger                                   EventHub                            [C#]              Azure Function                       
ServiceBusQueueTrigger                            SBQueue                             [C#]              Azure Function                       
ServiceBusTopicTrigger                            SBTopic                             [C#]              Azure Function                       
EventGridTrigger                                  EventGrid                           [C#]              Azure Function                       
IotHubTrigger                                     IotHub                              [C#]              Azure Function                       
CosmosDBTrigger                                   CosmosDB                            [C#]              Azure Function                       
Azure Functions                                   azureFunctionsProjectTemplates      [C#], F#          AzureFunctions/ClassLib              
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                          
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                              razor                               [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 viewstart
    dotnet new --help
Could not find something to uninstall called '/usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.32/templates/projectTemplates.nupkg'.
Usage: new [options]

Options:
  -h, --help          Displays help for this command.
  -l, --list          Lists templates containing the specified name. If no name is specified, lists all templates.
  -n, --name          The name for the output being created. If no name is specified, the name of the current directory is used.
  -o, --output        Location to place the generated output.
  -i, --install       Installs a source or a template pack.
  -u, --uninstall     Uninstalls a source or a template pack.
  --nuget-source      Specifies a NuGet source to use during install.
  --type              Filters templates based on available types. Predefined values are "project", "item" or "other".
  --force             Forces content to be generated even if it would change existing files.
  -lang, --language   Filters templates based on language and specifies the language of the template to create.

Templates                                         Short Name                          Language          Tags                                 
---------------------------------------------------------------------------------------------------------------------------------------------
QueueTrigger                                      Queue                               [C#]              Azure Function                       
HttpTrigger                                       Http                                [C#]              Azure Function                       
BlobTrigger                                       Blob                                [C#]              Azure Function                       
TimerTrigger                                      Timer                               [C#]              Azure Function                       
DurableFunctionsOrchestration                     DurableFunctionsOrchestration       [C#]              Azure Function                       
SendGrid                                          SendGrid                            [C#]              Azure Function                       
EventHubTrigger                                   EventHub                            [C#]              Azure Function                       
ServiceBusQueueTrigger                            SBQueue                             [C#]              Azure Function                       
ServiceBusTopicTrigger                            SBTopic                             [C#]              Azure Function                       
EventGridTrigger                                  EventGrid                           [C#]              Azure Function                       
IotHubTrigger                                     IotHub                              [C#]              Azure Function                       
CosmosDBTrigger                                   CosmosDB                            [C#]              Azure Function                       
Azure Functions                                   azureFunctionsProjectTemplates      [C#], F#          AzureFunctions/ClassLib              
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                          
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                              razor                               [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 SBTopic --namespace --Connection --TopicName mytopic --SubscriptionName mysubscription
    dotnet new --help
$ echo $?
0
$ tree
.
├── foo.cs
├── host.json
├── kentsfirstserverlessapp.csproj
└── local.settings.json

0 directories, 4 files
krancour commented 6 years ago

Update: This issue seems only to occur with .Net as the runtime.

ahmelsayed commented 6 years ago

Thank you again @krancour for the detailed report :) this was indeed a bug that has been fixed in 04c231b8a58325a1da36a4362b005ba4133f51c6. It has been released in 2.0.1-beta.33 can you try updating and trying again? Sorry I know out update cadence is inconsistent. Sometimes it's too frequent and sometimes it's not frequent enough

krancour commented 6 years ago

Thanks @ahmelsayed. Hope to try it soon and I'll let you know how it goes.

ahmelsayed commented 6 years ago

I'll close this issue. Feel free to reopen it if you are still seeing issues