【发布时间】:2011-01-14 20:26:12
【问题描述】:
我有一个引用一些 .Net dll 的应用程序,用于在不同格式之间转换文件。如果我添加对 .dll 文件的引用,我的应用程序将毫无问题地运行。
但是,如果我将 dll 添加到 GAC 并从那里引用它,由于解析错误,我的应用程序会在运行时失败。 dll的物理位置不变。
我有几个通过环境变量访问的配置文件,它们用于解析输入文件。
任何想法可能是什么问题?
private static string FILE_CONFIGURATION = "configuration.xml";
string configurationPath = "c:\\temp\\CDXMLViewerDist\\" + FILE_CONFIGURATION;
System.Environment.SetEnvironmentVariable(translator.domains.XMLDomainConfiguration.FILE_CONFIGURATION_PATH, configurationPath);
System.Environment.SetEnvironmentVariable(translator.domains.XMLDomainConfiguration.DOMAIN_CONFIGURATION_PROPERTY_KEY, typeof(XMLDomainConfiguration).FullName);
String strPath = "C:\\temp\\out.cdxml";
CDXMLReader reader = new CDXMLReader();
reader.Read(strPath); // Runs fine if reference dll as file, throws exception if via GAC
【问题讨论】:
-
您必须更好地描述“解析错误”。