7

I have a .NET Core 3 project in Visual Studio 2019. When I copy and paste a file, through Windows Explorer, into the project folder, Visual Studio automatically includes the file into my project, which I do not want to happen. Is there a setting to disable this feature?

Scott Forbes
  • 166
  • 2
  • 11

2 Answers2

7

Starting from VS 2017 project format in .NET has changed. You need to add <PropertyGroup> tag at the top of your .csproj file:

<PropertyGroup> 
    <EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>

Here is the complete answer to your question: In Visual Studio, why are all files automatically part of my C# project?

Likhtarovich
  • 86
  • 1
  • 2
0

Well, you can modify the known project file (.csproj for c# project), by customize the items include path that satisfied your include files specifically.

For more details, you can check these out: https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-well-known-item-metadata?view=vs-2015&redirectedfrom=MSDN

Understanding a csproj assembly reference

Including content files in .csproj that are outside the project cone

Enjoy and deploy with confidence!

OO7
  • 660
  • 4
  • 10