简体   繁体   English

在 Visual Studio for mac 中为控制台应用程序添加 app.config 文件

[英]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.

相关问题 如何在控制台应用程序中添加App.Config文件 - How to add App.Config file in Console Application 在Visual Studio中将控制台应用程序从4.5.1转换为3.5会导致不再拾取控制台App.config - Converting console application from 4.5.1 to 3.5 in visual studio causes the console App.config to no longer be picked up 如何在 Visual Studio Web 2013 中添加 app.config 或 web.config 文件? - How can I add an app.config or web.config file in Visual Studio Web 2013? 在Visual Studio Professional 2017中添加app.config(应用程序配置文件) - Adding app.config (Application Configuration File) in Visual Studio Professional 2017 如何将 app.config 文件添加到项目(控制台应用程序 C#) - How to add an app.config file to a project (Console Application C#) 如何在Visual Studio Code中添加App.Config? - How to add an App.Config in Visual Studio Code? 如何在控制台应用程序中将值永久写入app.config文件? - How to write value to app.config file permanently in a console application? .net 控制台应用程序中 app.config 文件中的 html 标签 - html tags in app.config file in .net console application 控制台应用程序中的 App.Config 文件 C# - App.Config file in console application C# 在App.config文件控制台应用程序中保护部分 - Protecting Section in App.config file Console Application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM