I want to introduce Git into my Visual Studio 2022 project, but where exactly should I place the .git directory (i.e., where should I run git init)?
I created a project called MyTestApp, but for some reason it was created in a nested structure like repos/MyTestApp and repos/MyTestApp/MyTestApp. I’m not sure which of these directories should have the .git repository.
This output was generated by running tree /F /A > filelist.txt in the terminal under "C:\Users\lapislazuli\source":
C:.
| filelist.txt
|
\---repos
+---MyTestApp
| MyTestApp.sln
|
\---MyTestApp
| App.config
| Form1.cs
| Form1.Designer.cs
| MyTestApp.csproj
| Program.cs
|
+---bin
| \---Debug
+---obj
| \---Debug
| | .NETFramework,Version=v4.8.AssemblyAttributes.cs
| | DesignTimeResolveAssemblyReferences.cache
| | DesignTimeResolveAssemblyReferencesInput.cache
| | MyTestApp.csproj.AssemblyReference.cache
| |
| \---TempPE
\---Properties
AssemblyInfo.cs
Resources.Designer.cs
Resources.resx
Settings.Designer.cs
Settings.settings
Exact steps I followed
- Double-click the Visual Studio icon on the taskbar to start it.
- The Visual Studio Installer window appears.
- Click [Launch] for Visual Studio Community 2022.
- The Visual Studio 2022 window appears.
- Click [Create a new project].
- Select [Windows Forms App (.NET Framework)].
- Click [Next].
- Click [Create] with the following settings:
- Project name: MyTestApp
- Location: C:\Users\lapislazuli\source\repos
- Solution name: MyTestApp
- “Place solution and project in the same directory” → unchecked
- Framework: .NET Framework 4.8
When I checked “Place solution and project in the same directory”, the nested structure did not occur. However, I’m not sure if that’s the correct approach.