0

I have a C# "Class Library" type project in Visual Studio 2015.

At the moment when i add in the project files like : json files or pictures, Visual Studio sets the build action for these files as "None" . I need them to be set as "Content".

At the moment i am making this seeting manually. However i am adding a large amount of files of that in my project.

Is there a way i can instruct visual studio to set automatically the build action to "Content" when i add them ? Also i need this option to be valid also on the TFS machine .

Lucian
  • 344
  • 1
  • 6
  • 19
  • https://stackoverflow.com/questions/1743432/how-can-i-automatically-add-existing-items-to-a-visual-studio-project – T.S. Sep 20 '17 at 06:25

1 Answers1

0

From this msdn article you can see that all files which are included in the build process have to be specified in a .<something>proj file, which is nothing more than a simple XML file.

For what you need I would unload the project within Visual Studio and open up the project file for edit. Find <ItemGroup> in that XML file and add <Content Include="Path-to-your-JSON-files\*.json" />.


<ItemGroup>  
    <CSFile Include="main.cs" />
    <!-- assume you have a bunch of these -->

    <Content Include="Path-to-your-JSON-files\*.json" />    
</ItemGroup>  
mrogal.ski
  • 5,828
  • 1
  • 21
  • 30