Reputation: 6441
I have a project with the following simplified dependency structure (there are many projects in total).
MainWindow
|- UserControl
|- Library
|- ExternalLib.dll
ExternalLib.dll is a Content resource with Copy Always.
When I build my project it correctly copies ExternalLib into my output folder. If I then click Debug it rebuilds my Library and UserControl projects and deletes my ExternalLib.dll
In the MSBuild build logs I see the following:
5>Task "Delete"
...
5> Deleting file "/path/to/bin/ExternalLib.dll".
5>Done executing task "Delete".
Why would MsBuild be deleting a dependency of a project that the project I'm building in dependent on?
Upvotes: 3
Views: 883
Reputation: 6441
I figured it out. Apparently if you have a project structure where A references B references C, if A doesn't need C the compiler is "smart enough" to delete C.
Because the reference to ExternalLib in my main application was through reflection, the compiler thought I didn't need the ExternalLib.
The problem can be solved in two ways:
Personally I went with the second option.
Upvotes: 1