Juri Strumpflohner
Juri Strumpflohner Juri is a full stack developer and tech lead with a special passion for the web and frontend development. He creates online videos for Egghead.io, writes articles on his blog and for tech magazines, speaks at conferences and holds training workshops.

Help, my MSTest DeploymentItem doesn't get deployed!

1 min read

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...
Questions? Thoughts? Hit me up on Twitter
comments powered by Disqus