Test environment does not copy my files

前端 未结 4 1102
醉话见心
醉话见心 2021-01-14 18:33

I use VS2010. In my test project I have a folder named \"MessageInstances\" and in that folder there is a subfolder \"GET_ACTIVITY\", inside that folder there are xml files.

4条回答
  •  一整个雨季
    2021-01-14 19:02

    The DeploymentItem attribute will only work if Build Action on the item is set to Content and the Copy to Output Directory is set to Copy if Newer or Copy always. Additionally, if your tests are running with a testsettings file you need to enable Deployment in the settings. Make sure you are editing the active test run config in case you have mutiple.

    Your DeploymentItem should be defined as follows:

    [DeploymentItem("MessageInstances\\GET_ACTIVITY\\", "MessageInstances\\GET_ACTIVITY")]
    

    Or using '@' instead of '\\'

    [DeploymentItem(@"MessageInstances\GET_ACTIVITY\", @"MessageInstances\GET_ACTIVITY")]
    

    i.e. you need to specify the output directory, otherwise the files will be copied to the Out directory of your test run.

提交回复
热议问题