我有一个 UserControl Library 解决方案,它具有以下内容
用户控件---用户控件项目
---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 下,那应该是我的程序集路径。什么给出了或者我需要做一些设置才能让它正确运行,以便它可以在正确的位置找到我的配置文件?