C# 在使用mono4的ubuntu上运行.net应用程序时引发ConfigurationErrorsException
我在vs2015rc中编写并编译了一个helloworld应用程序:C# 在使用mono4的ubuntu上运行.net应用程序时引发ConfigurationErrorsException,c#,ubuntu,mono,C#,Ubuntu,Mono,我在vs2015rc中编写并编译了一个helloworld应用程序: namespace Test { class Program { protected static readonly NameValueCollection AppSettings = ConfigurationManager.AppSettings; private static readonly string rootDir = AppSettings["RootDirPat
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();
}
}
}
当我使用mono4在ubuntu上运行此应用程序时,会抛出一个ConfigurationErrorsException
:
lijing@ubuntu:~/Desktop/iQQ.Net$mono Test.exe
未处理的异常:System.TypeInitializationException:异常
由Test.Program的类型初始值设定项引发
System.Configuration.ConfigurationErrorsException:初始化时出错
配置系统。
System.Configuration.ConfigurationErrorsException:无法识别
配置部分
(/home/lijing/Desktop/iQQ.Net/Test.exe.config第3行)
这是配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="RootDirPath" value="xxxxxxxxxxxxxxxxxxxx"/>
<add key="LibPath" value="Lib\win64\"/>
<add key="DataDirPath" value=""/>
</appSettings>
</configuration>
单声道版本是:
Mono JIT编译器版本4.0.2(稳定的4.0.2.5/c99aa0c星期三2015年6月24日10:04:37 UTC)