I'm unable to use ConfigurationManager.AppSettings in Coded UI

安稳与你 提交于 2021-01-29 08:09:16

问题


My code in VS2015 ultimate is:

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

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?).

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?


回答1:


I got the solution, I used this code

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

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



来源:https://stackoverflow.com/questions/53414794/im-unable-to-use-configurationmanager-appsettings-in-coded-ui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!