我无法在编码用户界面中使用ConfigurationManager.AppSettings [英] I'm unable to use ConfigurationManager.AppSettings in Coded UI

查看:66
本文介绍了我无法在编码用户界面中使用ConfigurationManager.AppSettings的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2015 Ultimate中的代码是:

My code in VS2015 ultimate is:

BrowserWindow browser = BrowserWindow.Launch(ConfigurationManager.AppSettings["URL"]);

在使用此代码时,我在代码中遇到错误,当我将鼠标悬停在该代码上时,我得到了这个'object'不包含"AppSettings"的定义,也没有扩展方法"AppSettings"接受第一个参数.

While using this code I'm getting error in the code and when I mouse hovered it I got this 'object' does not contain a definition for "AppSettings" and no extension method 'AppSettings' accepting a first argument of type object could be found(are you missing a using directive or an assembly reference?).

但是我已经使用System.Configuration; 提供了.并且此代码在VS2012 Ultimate中运行良好.谁能为我提供这个问题的解决方案?

But I have provided using System.Configuration;. And this code was working perfectly in VS2012 ultimate. Can anyone provide me a solution for this issue?

推荐答案

我找到了解决方案,我使用了这段代码

I got the solution, I used this code

BrowserWindow.Launch(System.Configuration.ConfigurationManager.AppSettings["URL"]);

此外,我在参考文献中添加了 System.configuration .然后它起作用了.

Also, I added System.configuration to the References. It then worked.

这篇关于我无法在编码用户界面中使用ConfigurationManager.AppSettings的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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