Visual Studio 2012 Express - Images not compiled / copied

Maybe someone here can help me. I am an amateur programmer with experience primarily in C #.

I started learning C ++ more in the last few days and ran into a problem that I cannot understand. I am using Microsoft Visual Studio 2012 Express for Windows Desktop.

Whenever I add resources, such as images (jpg, png, bmp) to my solution through the solution explorer, they are not copied to the solution folder on the hard drive. An even bigger problem is that these images are not copied or compiled when compiling my project !! Therefore, the program does not start. If I manually copy the files to the Debug folder, then everything works fine. I set the "Content" property in the properties of the "True" file, as well as the "Add to project" property.

I can’t understand this because of his life. :( In MS Visual Studio 2010 Express C # it always worked. Is there something missing in the new version?

Btw, sorry if some of them make no sense. English is not my first language, and I use Visual Studio in German.

Hope someone can give me an answer!

Yours faithfully,

Michael

+4
source share
2 answers

In Solution Explorer, right-click the files and select Properties. Then change "Copy to output directory" to "Always." It is also possible to change the "Build Action" to "Content".

+2
source

I have the same problem in my C ++ projects in Visual Studio 2013. I could not find the option “copy if new” or “always copy”. If there is one in C ++, let me know.

For editing, I edited the [Projectname] .vcxproj file.

Find a line like this:

<None Include="./yourcontentfile.dll" /> 

or

 <Content Include="./yourcontentfile.dll" /> 

Change this line to the following:

 <None Include="./yourcontentfile.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> 

or

 <Content Include="./yourcontentfile.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> 

This will copy this file to the output directory when it is created.

+1
source

All Articles