Azure / Azure/azure-functions-core-tools

Check for dotnet does not use PATH variable (In first instance)

Open
#4,842 2 comments 0 reactions 0 assignees View on GitHub
area: cli bug Needs: Team Attention potential-bug
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
5d 4h
Merged PRs (30d)
15

Description

### Version

NPM 4.8

### Description

On my machine, I do not have admin rights (For the most part), therefore I have used the dotnet-install script to install .NET to a user folder, and this path has been added to my PATH environment variable for my user.

The PATH environment variable for the *system* does not contain dotnet tools.

At one point, I installed Visual Studio to work on something, and noticed that dotnet tools in my Program Files (Installed via Visual Studio) *had* been added to my PATH, which was causing issues. I removed this from the PATH system variable.

When I run an Azure Functions project, built on .NET 8, I get the following error :

```
[2026-03-25T02:54:51.741Z] Failed to start language worker process for runtime: dotnet-isolated. workerId:09311f94-6d48-4635-a32b-374e303cf207
[2026-03-25T02:54:51.741Z] Language Worker Process exited. Pid=6748.[2026-03-25T02:54:51.743Z] Removing errored webhost language worker channel for runtime: dotnet-isolated workerId:09311f94-6d48-4635-a32b-374e303cf207
[2026-03-25T02:54:51.745Z] Microsoft.Azure.WebJobs.Script.Grpc: C:\Program Files\dotnet\dotnet.exe exited with code -2147450730 (0x80008096). https://aka.ms/dotnet/app-launch-failed.

[2026-03-25T02:54:51.746Z] Microsoft.Azure.WebJobs.Script.Grpc: C:\Program Files\dotnet\dotnet.exe exited with code -2147450730 (0x80008096). https://aka.ms/dotnet/app-launch-failed.
[2026-03-25T02:54:51.768Z] A host error has occurred during startup operation '5da85eaf-805f-419f-bbf4-f4282e54d32b'.
[2026-03-25T02:54:51.770Z] Microsoft.Azure.WebJobs.Script.Grpc: C:\Program Files\dotnet\dotnet.exe exited with code -2147450730 (0x80008096). https://aka.ms/dotnet/app-launch-failed.
[2026-03-25T02:54:51.775Z] Stopping JobHost
```

Notice importantly : `C:\Program Files\dotnet\dotnet.exe exited`

It appears that it is still looking in my Program Files folder.

This folder *does* exist, and it *does* have the dotnet exe in it. However, it is only .NET 10, I have .NET 8 installed in my user folder.

I know this is a version issue because if I change my project to run on .NET 10, it runs successfully with no issues.

Looking at similar issues led me to this change : https://github.com/Azure/azure-functions-core-tools/pull/4738/changes

Here I can see the code actually first checks Program Files, THEN checks the PATH, in that order.

I know it would be a breaking change, but it creates this weird issue where other dotnet tools (For example the dotnet cli), uses PATH at the first instance and so uses a different version of dotnet than that of this azure functions CLI.

### Steps to reproduce

- Install .NET 8 to a custom location using dotnet-install script
- Install .NET 10 via Visual Studio (Possibly via exe or install script to C:/Program Files/dotnet
- Ensure that both User and System PATH environment variable only points to the custom location, not to C:/Program Files/dotnet
- Attempt to run an Azure Function built on .NET 8, it will fail

It fails because it checks the Program Files first instead of using the Path

Contributor guide

Open the contributing guide

Research direction

Review the runtime lookup change in PR #4738 and trace how the CLI chooses dotnet on Windows. Reproduce with .NET 8 in a user directory and .NET 10 in Program Files; done means the Azure Functions project uses the PATH-selected .NET 8 executable instead of the system installation.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.