MSTest.exe 找不到 app.config [英] MSTest.exe not finding app.config

查看:25
本文介绍了MSTest.exe 找不到 app.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试从 NCover 运行 MSTest.exe,但我相信这个问题通常适用于从命令行运行 MSTest.exe.

I'm currently trying to run MSTest.exe from NCover, but I believe the question could apply generally to running MSTest.exe from the command line.

如果我有/noisolation"参数,那么 MSTest.exe 似乎会按预期查找和使用 app.config.没有它,NCover 不会捕获任何覆盖信息.从我目前的研究来看,似乎 NCover 需要/noisolation.所以问题是如何让我的 *.config 文件在传递该参数时工作.

If I have the "/noisolation" argument, then MSTest.exe appears to find and use the app.config as expected. Without it, NCover doesn't capture any coverage information. From my research so far, it seems NCover needs /noisolation. So the question is how to get my *.config files to work when that argument is passed.

我的 NCover 设置是:

My NCover settings are:

个人资料申请
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe

Application to Profile
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe

工作文件夹
C:\Documents and Settings\MyProfile\My Documents\Visual Studio 2008\Projects\XYZ\XYZ.CoreTest\bin\Debug

Working Folder
C:\Documents and Settings\MyProfile\My Documents\Visual Studio 2008\Projects\XYZ\XYZ.CoreTest\bin\Debug

应用参数
/noisolation/testcontainer:"C:\Documents and Settings\MyProfile\My Documents\Visual Studio 2008\Projects\XYZ\XYZ.CoreTest\bin\Debug\XYZ.CoreTest.dll"

Application arguments
/noisolation /testcontainer:"C:\Documents and Settings\MyProfile\My Documents\Visual Studio 2008\Projects\XYZ\XYZ.CoreTest\bin\Debug\XYZ.CoreTest.dll"



更新:我添加了一条跟踪,显示我的配置(毫不奇怪)试图从C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe.Config"读取.



Update: I added a trace showing that my config is (not surprisingly) trying to read from "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe.Config".

更新 2:如果可能,我不想编辑 MSTest.exe.Config.那只是不太便携.

Update 2: If at all possible, I don't want to edit MSTest.exe.Config. That just isn't terribly portable.

推荐答案

来自 Craig Stuntz 在 链接文本

From Craig Stuntz in a comment at link text

如何使用 MSTest 做到这一点.

How to do this with MSTest.

  1. 在解决方案资源管理器中,右键单击解决方案(而不是项目).

  1. In Solution Explorer, right-click the Solution (not the Project).

点击添加、新建项目

在类别中,选择测试运行配置

In Categories, select Test Run Configuration

现在选择测试运行配置"项并将其添加到您的项目中

Now choose the Test Run Configuration item and add it to your project

在解决方案资源管理器中,双击您刚刚创建的测试运行配置

In Solution Explorer, double-click the Test Run Configuration you just created

点击部署项

将您的配置文件添加为部署文件(或部署包含它的整个文件夹,如果合适)

Add your config file as a deployed file (or deploy the entire folder which contains it, if appropriate)

这花了我一点时间才弄明白,但我处于类似的情况,它对我有用.

This took me a little while to figure out, but I'm in a similar situation and it does work for me.

这篇关于MSTest.exe 找不到 app.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆