我有一个用户控件库解决方案,它具有以下配置文件
用户控件 ---用户控件项目
---UserControl Test Project
在我的测试项目中,我能我的用户添加到工具框。当我把它拖放到我的表单中时,它就会失败。我把日志记录,发现我的用户控件读取配置文件。配置文件被标记为始终复制,并存在于obj \ debug和bin \ debug目录下。
然而,当我拖动用户控件在我的测试项目中的形式,它正试图从
Ç得到一个文件:\ Documents和Settings \ jondoe \本地设置\应用数据\微软\ VisualStudio的\ 8.0 \ ProjectAssemblies \ vqjlihdl01
以上是本
string pluginAssemblyPath = Assembly.GetExecutingAssembly().Location;
DirectoryInfo dirInfo = new DirectoryInfo(pluginAssemblyPath);
pluginAssemblyPath = pluginAssemblyPath.Replace(dirInfo.Name.ToString(),"");
string configFilePath = pluginAssemblyPath + "FileConfig.xml";
我会假设,如果我在调试模式下进行编译,该文件应该是在OBJ \调试这应该是我的装配路径的结果。什么给或有一些设置,我需要做到让它正确运行,以便它可以找到我的配置文件在正确的位置?
通常情况下,你会在我的答案下的评论(我假设你是回应我)。答案是好的,答案。 :-) – MusiGenesis 2008-12-11 17:02:46