470,593 Members | 2,461 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,593 developers. It's quick & easy.

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

87 64KB
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\config.xml" exited with code 4.
Please help.
Feb 24 '22 #1
0 4770

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by BuddyWork | last post: by
3 posts views Thread by moondaddy | last post: by
18 posts views Thread by mike3 | last post: by
4 posts views Thread by Jim Barlow | last post: by
185 posts views Thread by jacob navia | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.