-
Notifications
You must be signed in to change notification settings - Fork 289
Description
Description
I ran into an issue and it seems the process works the way it is described here https://msdn.microsoft.com/en-us/library/ms182475.aspx
In a way it's working as designed, but the design has a flaw as all the files from a dependency are not copied to the out folder.
Steps to reproduce
-
I created the project ClassLibrary1, a library with 1 class and 1 method.
-
To the ClassLibrary1 project I added TextFile1.txt file where the "Copy to Output Directory" is set to "Copy if newer". The 1 method reads the TextFile1.txt file.
Basically when I distribute ClassLibrary1, I need to provide both ClassLibrary1.dll and TextFile1.txt together. -
I created a unit test project UnitTestProject1 with 1 test method that calls the 1 method.
3.a. If UnitTestProject1 doesn't have any deployment item, the test runs from the unit test's bin\Debug folder and all is well.
3.b When UnitTestProject1 has a deployment item, vstest copies to the Out folder the deployment item, UnitTestProject1.dll and ClassLibrary1.dll but not TextFile1.txt. In this case vstest copies a non-functional version of ClassLibrary1 because its whole package is not copied.
Expected behavior
If UnitTestProject1 depends on a dependent project, all the files defined as output to this dependent project should be copied to the Out folder, even non-dll files, because the dlls and non-dlls make a whole functional set of files.
This is very much what a compiler does on an application ConsoleApp1 with a dependency on the ClassLibrary1. When ConsoleApp1 compiles, the compiler brings into its bin\Debug both ClassLibrary1.dll and TextFile1.txt, because that makes a whole functional file set.
Actual behavior
Because non dll files are not copied, when I have a dependent project I also need to add as deployment items all the files that are not dlls. This is the flaw.
Compared to the console project, the compiler doesn't need me to add the non-dll files from the ClassLibrary1 project into ConsoleApp1.csproj.
Environment
Any, it works as described, it's easy to reproduce.