Azure / Azure/azure-functions-core-tools

func init --csharp doesn't work on an existing project

Open
#2,849 2 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

It should be possible to use `func init` to create a local.settings.json file with a worker runtime value configured. This doesn't work for C#:

```
func init --csharp
Creating this template will make changes to existing files:
Overwrite ./.gitignore
Overwrite ./host.json

Rerun the command and pass --force to accept and create.

Error creating project template
```

Rerunning with `--force` is not helpful because we don't want to overwrite existing files.

Other languages like Python are working:

```
func init --python
Found Python version 3.8.7 (python3).
requirements.txt already exists. Skipped!
getting_started.md already exists. Skipped!
.gitignore already exists. Skipped!
host.json already exists. Skipped!
Writing local.settings.json
/myapp/.vscode/extensions.json already exists. Skipped!
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by running `func init --csharp` in an existing project containing `host.json` and `.gitignore`, then compare the result with `func init --python`. The work is done when C# initialization writes `local.settings.json` with the worker runtime without requiring existing files to be overwritten.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.