Placing files at solution level for project template
- Dominant language
- No language data
- Stars
- 1.7k
- Forks
- 399
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 39
Description
### Is your feature request related to a problem? Please describe.
Hi! [My template](https://github.com/NotNite/dalamud-plugin-template) is a single C# project, but I also want to create an .editorconfig and LICENSE file for new solutions. I've avoided making my template a solution template because I want users to be able to create a new project in an existing solution, which from my understanding isn't possible with solution templates (correct me if I'm wrong).
Right now, I'm solving this by using `..` with `rename`:
```json
{
"rename": {
".gitignore": "../.gitignore",
"LICENSE": "../LICENSE"
}
}
```
I'm doing this so that my template can be instantly ready to be committed to a Git repository, while also still being available to add to an existing solution. This has a few problems, though:
- This overwrites existing files when creating a new project in an existing solution (create a solution + project, add a .gitignore, create the template project in that solution).
- Even if those files don't already exist, it's not a great experience to add a project to an existing solution and have it create solution-wide files. I'd ideally have it only try and copy the files when creating a new solution+project in one go.
- When the project and solution are both in the same root folder (checking "Place solution and project in the same directory"), the files get created *outside* of the project folder! This also occurs when using the dotnet CLI.
Right now, I just have a symbol that the user can toggle off when creating a new project, but ideally I'd automatically detect the right conditions to create these files (creating a new solution+project and project is in a subdirectory). So far, I've tried:
- Using `context:createsolutiondirectory` and `context:isexclusive` as seen in [the wiki](https://github.com/dotnet/templating/wiki/Binding-and-project-context-evaluation) (doesn't work on the dotnet CLI or JetBrains Rider)
- Setting `preferNameDirectory` to `true` (doesn't seem to do anything?)
- Setting `editorTreatAs` to `solution` (also doesn't seem to do anything?)
### Describe the solution you'd like.
Either being able to detect when a new solution is being made (or a project is being made without a solution) in a condition, or being able to rename files into a solution directory (if it exists).
### Additional context
I've looked and there seems to be a lot of vaguely related issues, but none that specifically meet what I'm trying to do:
- https://github.com/sayedihashimi/template-sample/issues/31
- https://github.com/dotnet/templating/issues/5022
- https://github.com/dotnet/templating/issues/4840
- https://github.com/dotnet/templating/issues/4654
- https://github.com/dotnet/templating/issues/823
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.