Hello Wilnic,
I checked and tested the .runsettings file which you provided on my side and the tests worked well. I suggest you try following steps to troubleshoot.
- rename(or delete) the hidden .vs, bin and obj folders in your solution or project folder. After that rename(or delete) every subfolders named
ComponentModelCache
under this directoryC:\Users\[user name]\AppData\Local\Microsoft\VisualStudio\15.0_XXXXX
. Build and run tests again. - Close all Visual Studio instances and open Developer Command Prompt for VS 2017 > type
devenv /ResetSettings
> press Enter to reset Visual Studio default settings. - Try to create a new solution(project) and add the necessary codes, files and resources to the new solution(project) and check if it works this time. Or you can try to create a new .runsettings file and copy the content from the old .runsettings file to new one, then test again.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Update1
I suggest you try to just use runsettings file and set this parameter <DeploymentEnabled>false</DeploymentEnabled>
to <DeploymentEnabled>true</DeploymentEnabled>
to check if tests run.
Besides, did you enable deployment
and add related files or directory when using testsettings file?
Please also kindly try to directly use DeploymentItemAttribute Class
, for example [DeploymentItem("file1.xml")] [DeploymentItem("file2.xml", "DataFiles")] [DeploymentItem("bin\Debug")]
Best Regards,
Tianyu
1: https://learn.microsoft.com/en-us/visualstudio/ide/reference/resetsettings-devenv-exe?view=vs-2017 3: https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.testtools.unittesting.deploymentitemattribute?view=mstest-net-1.2.0#examples