Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copying Content files on build with Visual Studio Code

I'm working on a C# project that has Content files. In MonoDevelop, I can set the type to Content and the Build Action to Copy if Newer. I can do something similar in Visual Studio.

How do I do this with Visual Studio Code? I'm not opening a solution file (I'm opening a directory), and I don't see anything in tasks.json or in VSCode that I can use to configure this.

like image 511
ashes999 Avatar asked Sep 22 '16 01:09

ashes999


People also ask

How do I copy multiple files in VS Code?

In addition to ctrl + shift + v you can use ctrl + shift + c to Merge-Copy. And ctrl + shift + x to Merge-Cut. Select clipboard to paste ( ctrl + alt + v ). Paste and cycle through clipboard items ( ctrl + shift + v ).

How do I copy output in Visual Studio?

Copy to Output Directory is a property for files within a Visual Studio project. Select a Windows Form in a project, find Copy to Output Directory and note Copy to Output Directory is set to [Do not copy].


2 Answers

Updating the .csproj file with the below line of code helped me

 <Content Include="FolderPath/*">
    <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  </Content> 
like image 188
Automation Curry Puff Avatar answered Oct 04 '22 14:10

Automation Curry Puff


Try to manipulate csproj:

  <ItemGroup>
      <None Update="FILE_PATH">
          <CopyToOutputDirectory>ACTION_TYPE</CopyToOutputDirectory>
      </None>
  </ItemGroup>
  • FILE_PATH is relative path inside your project, ex. "nlog.config".
  • ACTION_TYPE - there are two possible choices: PreserveNewest (copy if never) and Always
like image 37
LukaszTaraszka Avatar answered Oct 04 '22 15:10

LukaszTaraszka