File marked "Contents" & # 8594; Copy always is not copied

I have a file in the folder of my C # VS2010 project with the mark Content and Always Copy .

When I change this file and save it, externally from VS, and then run the project, the modified file is not copied to the output. If I rebuild, then it is. I assume that VS does not use the modified file date stamp to determine whether to copy it or not.

Am I missing something? It drives me crazy when I lose 5 minutes per turn.

Thanks!

+6
source share
3 answers

It's hard to explain, so start by improving your diagnosis. Tools + Options, projects and solutions, build and launch settings. Change the "Output Size of the MSBuild Project Assembly" to "Normal." On the same property page, make sure that β€œOn When projects are out of date” is set to Always Build. Look in the Output window when you press F5 or Build + Build, the _CopyOutOfDateSourceItemsToOutputDirectory task is a copy of the file.

One possible pitfall when using Project + Add Existing Item: IDE makes a copy of the file you select. You may have changed the source file instead of a copy in the project directory. You fix this by clicking the arrow on the "Add" button in the dialog box and selecting "Add as link."

+7
source

The behavior you can expect can be achieved by changing the assembly action from "Content" to "Embedded Resource".

+1
source

In this case, when I needed to use COMFileReference , but also needed to copy the DLL to the output folder.

In the end, adding the DLL twice to the project as soon as Content for the copy to display the folder, and then as a COMFileReference . The easiest way is to modify .csproj xml directly.

0
source

All Articles