【问题标题】:Add app.config file for console application in Visual studio for mac在 Visual Studio for Mac 中为控制台应用程序添加 app.config 文件
【发布时间】:2019-03-07 21:54:25
【问题描述】:

我推荐this 为控制台项目添加配置文件。我已成功添加 app.config 但不知道如何使用它。我无法引用System.Configuration.ConfigurationManager.AppSettings;

它会产生以下错误,

“系统配置”中不存在类型名称或命名空间名称“ConfigurationManager”(您是遗漏和程序集参考吗?)”

我右键单击依赖项,但看不到“添加引用”选项。

【问题讨论】:

  • 不能引用是什么意思?请提供错误消息和更多信息。
  • 更新编译错误
  • 您需要在项目中添加对assembly System.Configuration.dll 的引用。见The name 'ConfigurationManager' does not exist in the current context。
  • 我在 Mac 上工作,我没有看到“添加引用”选项,但“添加包”可以让我进入 nuget。我是 C# 的新手并使用 mac。

标签: c# macos visual-studio app-config


【解决方案1】:

右击项目->点击“添加”->点击“添加Nuget包”

这将打开一个新窗口来添加 Nuget 包。

在搜索框中输入“System.Configuration”。您将看到一个包“System.Configuration.ConfigurationManager”。

添加这个包,这将解决您的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-21
    • 2018-07-11
    • 1970-01-01
    • 2021-07-19
    • 1970-01-01
    相关资源
    最近更新 更多