Help, my MSTest DeploymentItem doesn't get deployed!

MSTests allow you to define items you'd like to deploy to the deployment directory when executing the test cases. There are different ways for achieving this, either to configure it in your LocalTestRun.testrunconfig or to add attributes to your test case like
[TestMethod]
[DeploymentItem(@"files\somefolder\", "optionalOutputFolder")]
[DeploymentItem(@"files\someOtherFolder\", "againAnOptionalOutputFolder")]
public void MyDummyTest()
{
...
}
What may happen though is that despite defining this attribute, your files won't get copied to the deployment. If that's the case you have to make sure that you set the "Copy to Output Folder" setting to "Copy Always". This is kind of strange since by defining the DeploymentItem attribute one would imagine to have it already copied automatically. A bit of a messy implementation...
Kindle

blog comments powered by Disqus

Your ad here?