string sDir = @"d:\MSProject\Config\xx.xml";orstring sDir = Application.StartupPath + @"\Config\xx.xml";//Application.StartupPath为程序运行路径 例如exe在当前C:\Program Files\MyApp则完整路径为 C:\Program Files\MyApp\Config\xx.xml
调试欢乐多
我个人的写法是
d:/MSProject/Config/xx.xml这样就可以避免转义了
但和\的写法不知道有什么不同
我的意思是我建了一个安装项目,然后在下面定义了一个文件夹setupconfig里面有一个xml文件,我在再装过程中要用xml的内容写注册表,怎么才能找到这个路径
window下的两种写法都一样,不过linux下面只能一种
{
//安装目 RegistryKey rk = Registry.LocalMachine.CreateSubKey("Software\\Genersoft2\\SetupInfo");
rk.SetValue("InstallPath", this.InstallPath); //string vsGSPRegInfo = AppDomain.CurrentDomain.BaseDirectory + "\\SetupConfig\\注册表配置文件.xml";
//string vsConfigDir = this.InstallPath + "\\bscw_local\\GSP\\Config\\"; //RegisterAccess.Write(vsGSPRegInfo, vsConfigDir); }
我做的安装程序在d:安装目录的下放置了xml。但是在测试安装过程中提示c:windows/win32找不到xml。怎么会读到c:盘去了呢。Application.StartupPath也一样