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:
- TestApp1 (Windows application)
- TestAppA (Windows application)
- TestProj1 (Class library)
- TestProjA (Class library)
The dependencies are as follows (dependency as in project reference).
- TestProj1 depends on nothing.
- TestApp1 depends on TestProj1
- TestProjA depends on TestProj1
- TestAppA depends on TestProjA (and hence indirectly on TestProj1)
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
- TestApp1\bin\Debug
- TestProj1\bin\Debug
- TestProjA\bin\Debug
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?