c# - ubuntu用mono4跑exe,读取app.config总是异常

 给糖就不骗你 发布于 2022-10-28 00:43

ubuntu用mono4跑exe,报读取app.config异常,是怎么回事。用mono3的时候没问题.
异常信息如下:
System.TypeInitializationException: An exception was thrown by the type initializer for Test.Program ---> System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section (/home/lijing/Desktop/iQQ.Net/Test.exe.config line 3)

程序就是一个简单的helloworld

namespace Test
{
    class Program
    {
        protected static readonly NameValueCollection AppSettings = ConfigurationManager.AppSettings;
        private static readonly string rootDir = AppSettings["RootDirPath"] ?? "";

        static void Main(string[] args)
        {
            Console.WriteLine("hello world");
            Console.WriteLine(rootDir);
            Console.ReadKey();
        }
    }
}


  
    
    
    
  

mono版本如下:
Mono JIT compiler version 4.0.2 (Stable 4.0.2.5/c99aa0c Wed Jun 24 10:04:37 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有