Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DeploymentItem in vs2012 Doesn’t copy files

I want to add a deployment item to my test.

My solution structure looks like:

MySolution\
-- TestData\
  --addresses.xml
-- ProjectName.TestProject\
  --Internal\
    --MyTestClass.cs 

I’ve tried to add the file with the following attribute:

[DeploymentItem(@"TestData\addresses.xml", " TestData")]

…what does not work But if I specify the absuluten file path, vs will copy the file.

[DeploymentItem(@"C:\Dir1\Dir2\TestData\addresses.xml", " TestData")]
like image 627
musium Avatar asked Jan 24 '13 12:01

musium


1 Answers

Current folder for DeploymentItemAttribute defaults to output bin folder. So you have to specify first parameter relative to that bin folder:

[DeploymentItem(@"..\..\..\TestData\addresses.xml", " TestData")]
like image 122
Anri Avatar answered Oct 12 '22 19:10

Anri