Reputation: 14472
I have a file in a folder of my C# VS2010 project marked Content
and Always Copy
.
When I change this file and save it, externally to VS, and then run the project, the modified file is not copied to the output. If I rebuild, then it is. My guess is that VS does not use the modified date time stamp of the file to determine whether it should be copied or not.
Am I missing something? It's driving me nuts as I'm losing 5 minutes per run.
Thank you!
Upvotes: 9
Views: 11831
Reputation: 863
The behavior you are expecting can be achieved by changing the Build Action from "Content" to "Embedded Resource".
Upvotes: 5
Reputation: 942348
Hard to explain so start by getting better diagnostics. Tools + Options, Projects and Solutions, Build and Run settings. Change the "MSBuild project build output verbosity" setting to Normal. In that same property page, ensure that the "On Run, when projects are out of date" setting is set to Always build. Look in the Output window when you press F5 or Build + Build, the _CopyOutOfDateSourceItemsToOutputDirectory task is the one that copies the file.
One possible trap when you use Project + Add Existing Item: the IDE makes a copy of the file that you selected. You might be changing the original file instead of the copy in the project directory. You'd fix that by clicking the arrow on the Add button in the dialog and selecting "Add As Link".
Upvotes: 8
Reputation: 16680
Came across this when I needed to use COMFileReference
but also needed to copy the DLL to the output folder.
In the end, ending up adding the DLL twice to the project, once as Content
for the copy to output folder and once as COMFileReference
. Easiest way I found was to modify the .csproj
xml directly.
Upvotes: 1