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:

  1. Add file to MSTest project and set it to copy always.
  2. Go to Test -> Edit test settings -> Local(local.testsettings)
  3. Select Deployment
  4. Check “Enable deployment”
  5. Add DeploymentItem(“nameoffile”) attribute to test
  6. RESTART Visual Studio!
Remember to do step 6 because it will only begin working after Visual Studio is restarted.