visual-studio-2010installationinstallation-path

extra backslash in the installation path


I am using VS installer to create an installer for my application. I have a custom action which will pass the installation path to the code behind like the following : /path="[TARGETDIR]\" . Inside my installer Class I am displaying the installation path in the Install() method as path = Context.Parameters["path"]; MessageBox.Show(pathh); however, what is displayed is something like this:c:\Program Files(x86)\Manufacturer\Applicationname\\ So I don’t know how this extra backslash is added and do not know how to remove it . Any idea? it is worth mentioning that i was able to creat a file in the installtion path using "pathh"


Solution

  • If you are just want to display the path to the user u can use the following simple trick which works fine in your case: string path = pathh.Remove(pathh.Length-1); MessageBox.Show(path); Hope it helps.