Azure / Azure/azure-functions-core-tools

Add current directory to "Unable to find project root" error

Open
#1,214 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
5d 4h
Merged PRs (30d)
15

Description

We had an issue in the VS Extension (https://github.com/Microsoft/vscode-azurefunctions/issues/1175) where the user kept getting this error:
```
> Executing task: func host start <

Unable to find project root. Expecting to find one of host.json, local.settings.json in project root. The terminal process terminated with exit code: 1
```

This was the root cause as described by @petmat

> I'm using Powershell as the integrated terminal in Visual Studio Code. Some time ago I set the profile file to do the following things:
> ```
> Set-Location C:\
> ```
>
> I did that because the default way Powershell works is that when you start it the default folder is the profile-folder in Windows and I would prefer it to be the root of the C-drive.
>
> However this has an unwanted side-effect of forcing the integrated terminal in Visual Studio Code to always open in the same `C:\` directory.

It feels like some of the headache could've been saved if the error message had the current directory in the message. Something like this:
```
Unable to find project root in folder "C:\". Expecting to find one of host.json, local.settings.json in project root. The terminal process terminated with exit code: 1
```

Contributor guide

Open the contributing guide

Research direction

Search the repository for the exact "Unable to find project root" message to locate the relevant entry point. Update the error wording to include the current directory, while retaining the existing expectations about host.json and local.settings.json; done means the message shows the directory where lookup failed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.