I have a problem with the "Copy to output" functionality in Visual Studio 2008. Maybe I'm misunderstanding how its supposed to work.
I have a solution with four projects:
The dependencies are as follows (dependency as in project reference).
In other words, the dependency tree looks like this.
TestApp1
TestProj1
TestProjA
TestProj1
TestAppA
TestProjA
TestProj1
(each project has a reference to the standard assemblies (system, system.core, etc) as well)
In TestProj1, I have added a text file, Test.txt. In the properties for this file, I have specified "Build Action: Content" and "Copy to Output Directory: Copy always".
When I build the solution, Test.txt is copied to
The file is not copied to TestAppA\bin\debug and this is what I find weird. Since TestProj1 relies on Test.txt to work, and TestAppA relies on TestProj1, via TestProjA, TestApp1 won't work.
If I add a project reference from TestAppA directly to TestProj1 (so I have one reference to TestProj1 and another to TestProjA), the file will be copied to the TestAppA\bin\debug folder.
Of course, I could set up a custom build event to copy the file Test.txt to TestAppA\bin\debug, but I have bad experiences with custom build events and would prefer to rely on the built-in copy mechanisms.
So my question is: Why isn't Test.txt copied to TestAppA\Bin\debug?
Todd's answered well already, but two more common solutions to this are:
I'd also suggest that all your dependencies could simply call an API in TestProj1 to retrieve the information they require, allowing that assembly to encapsulate the data and store it wherever, however, and in whatever format it likes.