How to include a file in Visual Studio MSTest
Once in a while I add a xml file to be processed as part of an integration test in a MSTest project in Visual Studio but the file is missing when the test is run. Here are the steps to get the file to show up when the test is run:
- Add file to MSTest project and set it to copy always.
- Go to Test -> Edit test settings -> Local(local.testsettings)
- Select Deployment
- Check “Enable deployment”
- Add DeploymentItem(“nameoffile”) attribute to test
- RESTART Visual Studio!
Remember to do step 6 because it will only begin working after Visual Studio is restarted.