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

Modify the CSPROJ adding this snippet:

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

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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s