Question

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"

Was it helpful?

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.

OTHER TIPS

Have you tried making your custom action without the trailing backslash?

Replace

/path="[TARGETDIR]\"

with

/path="[TARGETDIR]"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top