Azure / Azure/azure-functions-host
Azure Functions V4 (.NET 6.0) early preview - unable to create Functions if IDE previously had an earlier Core Tools version
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
If I install the Functions v4 runtime and .NET 6 preview on a machine that previously had an earlier Functions Core Tools install (eg v3), I get the following error when I try to add a Function to the project.
No templates found matching: 'HTTPtrigger'.
To list installed templates, run 'dotnet new --list'.
To search for the templates on NuGet.org, run 'dotnet new HTTPtrigger --search'.
Error creating function
Note: I get a comparable error regardless of what type of Function I try to add (eg QueueTrigger, etc).
My environment:
OS: Windows (eg Windows 10 or Windows Server 2019)
Core Tools Version: 4.0.3687 Commit hash: 9974228c80b20f3128903fac1035d94200d0ba5f (64-bit)
.NET SDKs:
3.1.302.15188
5.1.120.60105
6.1.21.35502
Node.js: 14.7.0
Visual Studio 2019
Repro steps:
1. On a machine that has an earlier Functions Core Tools install (eg v3), uninstall Functions Core Tools via Programs and Features and/or via npm uninstall -g azure-functions-core-tools. Confirm that the npm directory is automatically deleted from %USERPROFILE%\AppData\Roaming
2. Install Core Tools v4 preview via npm i -g azure-functions-core-tools@4 --unsafe-perm true , in a command line console running in admin mode
3. Confirm that the above Core Tools version is installed via func --version
4. For good measure, close the command prompt and open a new command prompt (in admin mode)
5. In a new folder, initialize a project via func init --csharp , and verify that the target framework of the csproj file is net6.0
6. Attempt to create an HTTP Function via the following command:
func new --name HttpExample --template "HTTP trigger" --authlevel "anonymous"
Expected result: Function would get created.
Actual result: above-mentioned error.
Same result if I run func new and then select HttpTrigger or another Function type in the list.
If I uninstall .NET 6 SDK, I can create Functions in the project. Once I have Function, I can use the above setup (with .NET 6 SDK installed) to build and run the project and execute the function.
Contributor guide
Research direction
Start by reproducing the issue with `func init --csharp` and `func new --name HttpExample --template "HTTP trigger" --authlevel "anonymous"` using the stated Core Tools and .NET SDK versions. Compare `dotnet new --list` and function creation with and without the .NET 6 SDK, then trace the Core Tools template-discovery entry point. Done means a project created after an earlier Core Tools install can create HTTP and other trigger functions on .NET 6.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100