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

解决方案 »

  1.   

    象对于@"d:\MSProject\Config\xx.xml";这样的写法
    我个人的写法是
    d:/MSProject/Config/xx.xml这样就可以避免转义了
    但和\的写法不知道有什么不同
      

  2.   

    二楼给个,在安装时还是提示在c:/windows/win32下
    我的意思是我建了一个安装项目,然后在下面定义了一个文件夹setupconfig里面有一个xml文件,我在再装过程中要用xml的内容写注册表,怎么才能找到这个路径
      

  3.   

    to:ccp5780199(观阴大湿) 
    window下的两种写法都一样,不过linux下面只能一种
      

  4.   

    那么多表示当前目录的函数 非要用AppDomain.CurrentDomain.BaseDirectory
      

  5.   

    private void WriteRegistryKey()
            {
                //安装目            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也一样
      

  6.   

    不好意思 没看清是做安装程序 看看Environment.CommandLine里有你的信息没