Question: The issue is simple really. Instead of creating folders in Visual Studio, I create a directory structure for my project on the file system. How do I include all the folders and files in a project, keeping the structure?

If I "Add Existing File" on a folder named Services and navigate to a file in the directory structure .. Services > AccountManagement > CreateAccount.cs, it appears in Visual Studio like so: Services > CreateAccount.cs. I do not want this.

I have an entire directory structure worked out already, as I am mimicking our client developers using the same structure for organization. How do I add all the folders and files to the project in Visual Studio? Or do I have to do what most Microsoft users do and "put up with it" and recreate each and every folder through Visual Studio?

Answer: 
In Visual Studio 2015, this is how you do it.

If you want to automatically include all descendant files below a specific folder:

```xml
<Content Include="Path\To\Folder\**" />

```

This can be restricted to include only files within the path specified:

```xml
<Content Include="Path\To\Folder\*.*" />

```

Or even only files with a specified extension:

```xml
<Content Include="Path\To\Folder\*.jpg" >

```
Visual Studio 2017 and newer support a new lightweight `.csproj` format which has come to be known as "SDK format". One of several advantages of this format is that instead of containing a list of files and folders which are *included*, files are wildcard included by default. **Therefore, with this new format, your files and folders - added in Explorer or on the command line - will get picked up automatically!**

The SDK format `.csproj` file [currently works with the following project types](https://natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/):

* Class library projects
* Console apps
* ASP.NET Core web apps
* .NET Core projects of any type

To use the new format, create a new .NET Core or .NET Standard project. Because the templates haven't been updated for the full .NET Framework even in Visual Studio 2019, to create a .NET class library choose the .NET Standard Library template, and then edit the project file to target the framework version of your choice (the new style project format can be edited inside Visual Studio - just right click the project in the Solution Explorer and select "Edit project file"). For example:

```xml
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net46</TargetFramework>
  </PropertyGroup>
</Project>

```

Further reading:

* [Old csproj to new csproj: Visual Studio 2017 upgrade guide](https://natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/)
* [Demystifying the SDK Project](https://dansiegel.net/post/2018/08/21/demystifying-the-sdk-project)
* [MSDN: Additions to the csproj format for .NET Core](https://learn.microsoft.com/en-us/dotnet/core/tools/csproj)