Stop Visual Studio 2019 from automatically adding files in project folder
Asked Answered
A

2

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?

Ayana answered 23/1, 2020 at 16:46 Comment(1)
Does this answer your question? In Visual Studio, why are all files automatically part of my C# project?Agnella
W
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?

Waldheim answered 12/2, 2021 at 14:24 Comment(0)
N
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!

Nason answered 23/1, 2020 at 17:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.