[英]Add app.config file for console application in Visual studio for mac
I referred this to add a config file for console project.我引用这个来为控制台项目添加一个配置文件。 I have successfully added app.config but do not know how to use it.
我已经成功添加了 app.config 但不知道如何使用它。 I cannot reference
System.Configuration.ConfigurationManager.AppSettings;
我无法引用
System.Configuration.ConfigurationManager.AppSettings;
It produces the following error,它产生以下错误,
The typename or namespace name 'ConfigurationManager' does not exist in the 'System Configuration(' are you missong and assembly reference?)'
类型名称或命名空间名称“ConfigurationManager”不存在于“系统配置(”您是否遗漏了歌曲和程序集引用?)”
I right-clicked on dependencies but cannot see the option 'add references'.我右键单击了依赖项,但看不到“添加引用”选项。
Right click on project -> Click "Add" -> Click "Add Nuget Packages"右键单击项目-> 单击“添加” -> 单击“添加 Nuget 包”
This will open up a new window to add Nuget packages.这将打开一个新窗口来添加 Nuget 包。
Type "System.Configuration" in search box.在搜索框中键入“System.Configuration” 。 You will see a package "System.Configuration.ConfigurationManager" .
您将看到一个包“System.Configuration.ConfigurationManager” 。
Add this package, this will resolve your problem.添加此包,这将解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.