DeploymentItem not deploying files

前端 未结 3 1333
别那么骄傲
别那么骄傲 2021-01-01 17:44

I am using MS unit testing framework for testing my C# library. I have to open a file which I\'m deploying using DeploymentItem attribute. But it i

相关标签:
3条回答
  • 2021-01-01 18:03

    I had a set of tests where the copy was working for some tests but not the latest, even though the DeploymentItem attribute was set exactly the same way. After exhausting everything else, I did a "Clean solution" on the solution and reran and it started copying correctly. YMMV

    0 讨论(0)
  • 2021-01-01 18:16

    I have found two possible solutions in this thread:

    1. Set the "Copy To Output Folder" property of your deployment files to "Copy Always" (see Problems with DeploymentItem attribute)
    2. Check the "Enable Deployment" setting in the Local.testsettings file (see Problems with DeploymentItem attribute)

    Hope this helps.

    0 讨论(0)
  • 2021-01-01 18:21

    For future references, from what I have noticed using VS 2015 - the path you specify in the deployment item attribute must be relative to the build output (debug folder). If your folder structure is "UnitTesting\TestData\Test.xml" the DeploymentItem must be DeploymentItem("..\..\TestData\Test.xml") In this case, the TestData folder need not be included in the UnitTesting project.

    0 讨论(0)
提交回复
热议问题