在VS2010和VS2012中,DeploymentItem的行为有所不同

编程入门 行业动态 更新时间:2024-10-26 00:24:31
本文介绍了在VS2010和VS2012中,DeploymentItem的行为有所不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个VS2010解决方案,我正在尝试升级到VS2012.

I have a VS2010 solution that I'm trying to upgrade to VS2012.

我在VS2012中的MSTest单元测试中遇到问题.所有测试都在测试类上包含DeploymentItem属性.

I'm having a problem with the MSTest unit tests in VS2012. All of the tests include DeploymentItem attributes on the test class.

[TestClass] [DeploymentItem(@"SubDir\SubDir2\models", "models")] public class UnitTests { ... }

在2010年,它可以正确地从SolutionDirectory\SubDir\SubDir2\models目录复制依赖文件.

In 2010, it's correctly copying dependent files from the SolutionDirectory\SubDir\SubDir2\models directory.

2012年,它试图从部署测试的目录中复制SolutionDirectory\UnitTests\bin\debug\SubDir\SubDir2\models

In 2012, it's attempting to copy from the directory where the tests are deployed SolutionDirectory\UnitTests\bin\debug\SubDir\SubDir2\models

我正在寻找一种还原旧行为的方法.

I'm looking for a way to restore the old behavior.

推荐答案

如果在解决方案中创建测试设置文件,请在其中启用部署(默认情况下,测试设置中的部署处于关闭状态),然后在测试浏览器中将其选中(测试->测试设置->选择测试设置文件),那么它也应该工作而无需更改代码.

If you create a test settings file in your solution, enable deployment in it (by default deployment is off in the test settings) and select it in the test explorer (Test -> Test Settings -> Select test settings file), then it should work without changing the code as well.

更多推荐

在VS2010和VS2012中,DeploymentItem的行为有所不同

本文发布于:2023-11-05 15:50:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1561250.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有所不同   DeploymentItem

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!