MSTest DeploymentItem不会将文件复制到输出目录

f4x*_*f4x 2 mstest deploymentitem

美好的一天!

我有以下项目结构:

Solution
-My.Project
-My.Project.Test
--Resources
---mytest.file
Run Code Online (Sandbox Code Playgroud)

在我的测试文件中跟随方法:

[TestMethod]

[DeploymentItem("My.Project.Test\\Resources\\mytest.file", @"Resources")]

TestMethod()

{

....

string path = "Resources\\mytest.file"; ....

}
Run Code Online (Sandbox Code Playgroud)

根据http://msdn.microsoft.com/en-us/library/ms182475%28v=vs.100%29.aspx,我想使用DeployItemAttribute而不使用"部署项属性".

但是当我调试它的方法时,我抓住了"File not found exception".

我能做什么?

PS:还在http://social.msdn.microsoft.com/Forums/en-US/vststest/thread/474d51ee-7ab9-4311-b7b0-b21266eb01d5上发布了这个问题

最好的祝福!

Ele*_*ena 9

检查要部署的文件的属性(mytest.file).

"复制到输出目录"应设置为"始终复制"(默认设置为"不复制").