I have a C++ project in Visual Studio. I want to add a readme file to it and that it will be copied to the build folder with exe. Is there any built-in feature in Visual Studio 2010 and 2013?
-
No big thing but please tell us which VS version you are using. – TobiMcNamobi Feb 04 '15 at 08:48
-
It is 2010 and 2013 - depends on the developer. – Tanya Feb 04 '15 at 08:52
-
1possible duplicate of [Automatic copy files to output during application building](http://stackoverflow.com/questions/5779703/automatic-copy-files-to-output-during-application-building) – Gábor Angyal Feb 04 '15 at 09:07
-
Thank you! This is working! I just wonder how people know this stuff!? – Tanya Feb 04 '15 at 11:12
-
Some people read reference manuals too much :D – Gábor Angyal Feb 04 '15 at 11:32
2 Answers
At project properties (Project menu --> [Project name] properties... menu or ALT+F7) you can find the Post-Build Event tab (Configuration properties --> Build events --> Post-Build Event). Here you can write your macro which copies the readme file to the build folder. You can use the build-in macros to use special folder (i.e. build folder):
https://msdn.microsoft.com/en-us/library/c02as0cs.aspx
A possible solution: copy $(ProjectDir)\ReadMe.txt $(TargetDir)

- 3,535
- 1
- 20
- 23
The easyest way to do this, is right-clicking the file in the solution explorer, choose properties, and there set the "Copy to output directory" option.
Update
As Tanya pointed out this option is only visible in C# projects, but not in C++. The option exists though, only not exposed to the UI. See the answers to this question:

- 1
- 1

- 2,225
- 17
- 27
-
There is no option for this for C++ projects. At least I did not find it. I used this for C# projects and wondered if there such a thing for c++. – Tanya Feb 04 '15 at 08:58