How to make Visual Studio copy a file from a folder in the project to the Output Folder!

How to make Visual Studio copy a file from a folder in the project to the Output Folder!

The answer is in Stack Overflow 😉

NOTICE. The answer told you to put OutputPath, but I used OutDir

http://stackoverflow.com/a/4326337/1025407

Modify the CSPROJ adding this snippet:

 <ItemGroup>
    <AvailableItemName Include="RootContent">
      <Visible>false</Visible>
    </AvailableItemName>
  </ItemGroup>
  <Target Name="AfterBuild">
    <Message Text="Copiando bibliotecas nativas a carpeta de salida" />
    <Copy DestinationFolder="$(OutDir)" SourceFiles="@(RootContent)" SkipUnchangedFiles="true" />
  </Target>

Go the to Solution Explorer and go to the properties of the file you want to copy to the output folder (usually \bin). Set the Build Action to RootContent.

Done!

Anuncios