What does the Content Build Action in Visual Studio do? It does not look like it's doing anything.
The File Properties article on MSDN (does not exist anymore) says:
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.
But I have no idea what the "Content output group" means.
Is this something about deployment? Meaning, the action has no actual effect, when building, but only later when deploying?
using command promptClick in the solution explorer the file that will be modified. Then hit F4 or click with the right button in the file and then select the "Properties" option. In the Properties window, change Build Action to Embedded Resource.
To open the project's property pages, right-click on the project node in Solution Explorer and select Properties. Select the appropriate tab based on your project type: For C#, select the Build tab. For Visual Basic, select the Compile tab.
There is an option under 'project and solution' / 'Build and run', 'only build startup projects and dependencies on Run' that helps. Edited: Ctrl-f7 for 'build file' is for C++ projects.
Open Solution Explorer add files you want to embed. Right click on the files then click on Properties . In Properties window and change Build Action to Embedded Resource . After that you should write the embedded resources to file in order to be able to run it.
"Content" means that it is a deployable project item, it signals that the file needs to be copied to the target machine.
Something you can see with a simple console mode project. Project + Add New Item, pick the Bitmap File item template. Its Build Action is automatically set to "Content". Use Project + Properties, Publish tab and click the Application Files button. Note how the bitmap automatically got added to the list of deployed files:
Go back to the Properties window and change its Build Action to None. Click the button again and note how the file is now no longer included.
Also used by installer utilities that integrate with VS for the exact same reason. And a big deal in web applications, they usually have a lot of files that need to be deployed to the web server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With