简体   繁体   中英

Changing the name of a DeploymentItem

I am using DeploymentItem s to deploy test files. I was wondering if it was possible to change the name of the deployed file in the deployed location instead of just doing a copy. For example:

[DeploymentItem("path/to/my/file/test.txt", "testfiles/somethingelse.txt")]

It would deploy test.txt but it would rename the file to somethingelse.txt.

Or do I just have to do this manually using the File I/O API before I run my actual test?

It appears that this is not possible. One must copy files manually during test setup.

http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.deploymentitemattribute.aspx

(Optional) Target directory path must be a folder, and it is relative to the deployment directory. If the folder does not exist, it will be created. The default value is the deployment directory. You cannot change the file name by using DeploymentItem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM