Visual Studio C ++ project management. How to handle files without code in a project?

I have a project in C ++ solution. For this project, I have some config files that I would like to deal with within the project, and when I build the project, these config files are added to the build executable path in the correct directory structure.

Example:

test.exe links config / myconfig.txt

Is there a way to set up myconfig.txt and my project, so when I create test.exe I get

/

and

//config/config.txt

so when I run the test, all the paths stay in the correct order, without having to go in and manually create those directories.

I'm not sure if I have any meaning here, but perhaps one of you will understand where I am going.

0


source to share


2 answers


You can use pre-build events to create directories and copy files.



+6


source


In Visual Studio Solution Explorer, you can right click on files without code, select Properties, and set the Copy to Output Directory property.



This creates a rule in the build file to (1) include the file and (2) copy that file as part of the build process. In other words, you can get this behavior without Visual Studio, but do a little more work.

0


source







All Articles