MSTest.exe没有找到的app.config没有找到、exe、MSTest、app

2023-09-02 20:49:08 作者:古佛青灯

目前,我试图从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)的微软的Visual Studio 9.0 Common7 IDE MSTest.exe

Application to Profile C:Program Files (x86)Microsoft Visual Studio 9.0Common7IDEMSTest.exe

工作文件夹 C: Documents和Settings 我的资料我的文档 Visual Studio 2008的项目某某 XYZ.CoreTest 斌调试

Working Folder C:Documents and SettingsMyProfileMy DocumentsVisual Studio 2008ProjectsXYZXYZ.CoreTestbinDebug

应用程序参数 / noisolation / testcontainer:C: Documents和Settings 我的资料我的文档 Visual Studio 2008的项目某某 XYZ.CoreTest 斌调试 XYZ.CoreTest.dll

Application arguments /noisolation /testcontainer:"C:Documents and SettingsMyProfileMy DocumentsVisual Studio 2008ProjectsXYZXYZ.CoreTestbinDebugXYZ.CoreTest.dll"

更新:我添加了一个跟踪显示,我的配置是(不奇怪)尝试读取C: Program Files文件(x86)的微软的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.0Common7IDEMSTest.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.

推荐答案

从克雷格斯顿茨的评论在link文字

From Craig Stuntz in a comment at link text

如何使用MSTest的做到这一点。

How to do this with MSTest.

在Solution Explorer中,用鼠标右键单击该解决方案(而不是项目)。

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

在Solution Explorer中,双击您刚刚创建的测试运行配置

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.