How do I add file copying functionality to my .csproj file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xarzu
    New Member
    • Apr 2007
    • 90

    How do I add file copying functionality to my .csproj file?

    This is using C# coded using Microsoft Visual Studio 2019 Professional

    I have an XML file used as a configuration in my program that I am coding. The executable reads and writes to the XML file. So I would naturally like to have an automatic process where the XML file is moved from where it resides among of the source to where the compiled executable will be built. I imagine the moving of the xml file could be done during the pre-build or post-build process. And so, I tried adding some "xcopy" messages in the "Build Events" box that is found in the Properties setting of the project file. Another optioni, I assume, is to edit the project file by hand using a text editor. But I am not accustomed to the scripting language of this code. When I tried to type the pre-build commands I tried:
    xcopy config.xml $(OutDir)config .xml
    and the error during the Build is
    The command "xcopy config.xml bin\x64\Debug\c onfig.xml" exited with code 4.
    Please help.
Working...