Copy to Output Directory for images not working + Visual Studio 2010
I am currently developing an application using C# WPF. I am making a website help file system for my program. I am creating the HTML files in the default project file location (i.e. where all the .cs files are stored).
On the HTML files I want to copy I have right clicked on each file and said include in project and said Copy If Newer under Copy to Output Directory.
This is working fine开发者_Python百科 with HTML files but for image files (png) it is not doing anything but there is no error either.
The BuildAction property indicates what Visual Studio does with a file when a build is executed. BuildAction can have one of several values:
None - The file is not included in the project output group and is not compiled in the build process. An example is a text file that contains documentation, such as a Readme file.
Compile - The file is compiled into the build output. This setting is used for code files.
Content - The file is not compiled, but is included in the Content output group. For example, this setting is the default value for an .htm or other kind of Web file.
Embedded Resource - This file is embedded in the main project build output as a DLL or executable. It is typically used for resource files.
Sounds to me like you want Content.
Select the image files in Solution Explorer and change the Build Action property to Content.
Just found out by chance that I have to change the build action to Embedded Resource for the image I wanted to include in the project and copy to the output directory
精彩评论