我在解决方案中加载 XML 属性文件时遇到问题。在这个函数中:
public ApplicationSettings readApplicationSettings ()
{
if (isDeserialized)
return settings;
XmlSerializer serializer = new XmlSerializer (typeof(ApplicationSettings));
using (FileStream inputFileStream =
new FileStream(AppDomain.CurrentDomain.BaseDirectory + "ApplicationSettings.xml", FileMode.Open))
{
this.settings = (ApplicationSettings) serializer.Deserialize(inputFileStream);
}
isDeserialized = true;
return settings;
}
当从 monoDeveloper 运行时,该解决方案运行得非常好。从发布文件夹运行时,应用程序显示“无法加载文件... ApplicationSettings.xml”错误。尽管从 linux 终端运行相同的构建应用程序时,它运行时没有错误。
我尝试更改应用程序的权限,但没有帮助。
请帮忙。