Test environment does not copy my files

前端 未结 4 1103
醉话见心
醉话见心 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:00

    If you bring up the properties of the files in the solution explorer, verify that the files are set to Build Action: Content and Copy to output director: Always

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-14 19:15

    Per MSDN , you can also try this if this helps,

    To select files or folders to deploy, in run configuration

    In Solution Explorer, under Solution Items, double-click the run configuration file that you want to edit.

    A dialog box that has a name such as .testrunconfig appears. Click Deployment.

    Under Additional files or directories to deploy, specify additional files or folders to be copied.

    To do this, click Add file to select files; this opens the Add Deployment Files dialog box.

    You can also click Add Directory to select folders by using the Add Deployment Directory dialog box.

    In the .testrunconfig dialog box, click Save and then click OK.

    These deployment items will be copied to the deployment folder whenever this run configuration file is active.

    Hope this will help.

    0 讨论(0)
  • 2021-01-14 19:20

    Some my colleagues experienced the similar problem with ReSharper MS test runner.  The bug was specific for ReSharper 7.1 and has been fixed in current 7.1.1.

    See http://youtrack.jetbrains.com/issue/RSRP-335233#tab=Comment

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