【发布时间】:2010-09-26 11:18:43
【问题描述】:
我有一个用户控件库解决方案,它具有以下内容
用户控件 ---用户控制项目
---UserControl Test Project
在我的测试项目中,我可以将我的用户控件添加到工具箱中。当我将它拖放到我的表单中时,它失败了。我输入日志,发现我的用户控件读取了一个配置文件。配置文件被标记为始终复制并存在于 obj\debug 和 bin\debug 目录/中。
但是,当我将用户控件拖到我的测试项目中的表单时,它正试图从
获取文件C:\Documents and Settings\jondoe\Local Settings\Application Data\Microsoft\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\debug 下,并且应该是我的程序集路径。什么给出了或者我需要做一些设置才能让它正确运行,以便它可以在正确的位置找到我的配置文件?
【问题讨论】: