user1025852
user1025852

Reputation: 2794

Unit tests root dir to take deployment items

How can I declare that the "root" folder for all deployment items are the .sln dir?

Seems like I work really hard with relative paths of deployment items

 [TestMethod]
        [DeploymentItem(@"..\..\..\MyTestFilesFolder\myFile.xml")]
        public void Test_bla{}

Given that "MyTestFilesFolder" is near my .sln file (solution folder) I'd like to have

 [TestMethod]
            [DeploymentItem(@"MyTestFilesFolder\myFile.xml")]
            public void Test_bla{}

How can this be achieved with tests of vs2013?

Upvotes: 0

Views: 96

Answers (1)

Peter
Peter

Reputation: 27944

It seems you are not deploying the xml files with your unit tests. Go to the properties of the xml files and set the build action and to content and copy to output directory to copy always. Now the files are deployed to your test directory.

Upvotes: 1

Related Questions