I have VS 2012 project with structure like this:
Project
Folder1
file.xml
schema.xsd
code.cs
Folder2
code1.cs
code2.cs
I set Copy to output directory
property of file.xml
and schema.xsd
to Copy always
and want to output them to the same folder where assemblies outputed (bin\Debug
) but they always copied to folder bin\Debug\Folder1
. Is there a way to achieve my goal without moving files to the root of the project?
I recommend you do this with a Post-built event script. It's not as hectic as it sounds, and gives you loads of flexibility.
(See screenshots below)
You can now specify shell commands to be executed after each successful build of your project. The following achieves the example in your question:
copy "$(ProjectDir)Folder1\file.xml" "$(TargetDir)"
copy "$(ProjectDir)Folder1\schema.xsd" "$(TargetDir)"
$(ProjectDir)
and $(TargetDir)
are macros which insert the respective values relevant to your project. You can select and insert macros from the macro menu in the edit window.
The quotes are included above, because your ProjectDir
and TargetDir
might resolve to full paths that include spaces, and that will break the copy
command if the spaces aren't there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With