相关疑难解决方法(0)

如何查找活动的app.config文件的路径?

我正在尝试完成此异常处理程序:

if (ConfigurationManager.ConnectionStrings["ConnectionString"]==null)
{
    string pathOfActiveConfigFile = ...?
    throw new ConfigurationErrorsException(
       "You either forgot to set the connection string, or " +
       "you're using a unit test framework that looks for  "+
       "the config file in strange places, update this file : " 
       + pathOfActiveConfigFile);
}
Run Code Online (Sandbox Code Playgroud)

当我使用nUnit时,这个问题似乎只发生在我身上.

.net c# nunit configurationmanager app-config

163
推荐指数
6
解决办法
14万
查看次数

标签 统计

.net ×1

app-config ×1

c# ×1

configurationmanager ×1

nunit ×1