I am facing this unusual behavior from my Visual Studio where all of a sudden my test binaries(mytestsolution.dll) and the dependency binaries which are added in reference, are getting copied into TestResults\\Out folder from my Bin folder and starts executing from there?
This results in my tests getting failed as my GetExecutionAssembly() is giving the path of the Out Folder instead of Bin folder where some of the dependent binaries exist?
Could any one please help me how to stop this?
"Copy to Output Directory" is the property of the files within a Visual Studio project, which defines if the file will be copied to the project's built path as it is. Coping the file as it is allows us to use relative path to files within the project.
Little too late to the party but here what I just learned from my experiment
Env: net45, VS2017, Microsoft.VisualStudio.QualityTools.UnitTestFramework
When my TestMethod
has DeploymentItemAttribute
, it executes from TestResults\....\Out
folder. When I remove DeploymentItemAttribute
it executes from bin\debug
.
Visual Studio 2010 creates a folder TestResults and deploys all relevant files in subdirectories with the following schema: username_computername date time.
This is the normal behavior if you don't have a .testsettings file for your solution. The .testsettings file is situated in folder Solution Items.
If you have a .testsettings file, it depends on the setting of Enable Deployment in the Deployment section. If Enable Deployment is checked, the TestResults folder will be created and filled.
In some cases it is possible that the TestResults folder will be created although Enable Deployment is deactivated. But in this case the folder is used only for some temporary files, not for the execution files of your tests.
For more infos see:
MSDN - Test Deployment Overview
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With