DeploymentItem in vs2012 Does not copy files

I want to add a deployment item to my test.

My solution structure looks like this:

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

Ive tried adding a file with the following attribute:

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

... that doesn't work But if I specify the path to the absuluten file, vs will copy the file.

[DeploymentItem(@"C:\Dir1\Dir2\TestData\addresses.xml", " TestData")]
+5
source share
1 answer

The current DeploymentItemAttributedefault folder is for displaying the bin folder. Therefore, you need to specify the first parameter relative to this bin folder:

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

All Articles