Copying files into the application folder at compile time
Personally I prefer this way.
Modify the .csproj
to add
<ItemGroup>
<ContentWithTargetPath Include="ConfigFiles\MyFirstConfigFile.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>%(Filename)%(Extension)</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
or generalizing, if you want to copy all subfolders and files, you could do:
<ItemGroup>
<ContentWithTargetPath Include="ConfigFiles\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>%(RecursiveDir)\%(Filename)%(Extension)</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
You could do this with a post build event. Set the files to no action on compile, then in the macro copy the files to the directory you want.
Here's a post build Macro that I think will work by copying all files in a directory called Configuration to the root build folder:
copy $(ProjectDir)Configuration\* $(ProjectDir)$(OutDir)
You can use a MSBuild task on your csproj, like that.
Edit your csproj file
<Target Name="AfterBuild">
<Copy SourceFiles="$(OutputPath)yourfiles" DestinationFolder="$(YourVariable)" ContinueOnError="true" />
</Target>
You can also put the files or links into the root of the solution explorer and then set the files properties:
Build action = Content
and
Copy to Output Directory = Copy if newer
(for example)
For a link drag the file from the windows explorer into the solution explorer holding down the shift and control keys.