Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Using a directory path in a custom action
 

Using a directory path in a custom action

I have created a custom action that modifies a application config and configures a path into the configuration file. I have a custom text page added to the UI of the setup to prompt the user to enter the path.

The issue is that if the user does not terminate the path with a \ an error is generated from the setup runtime. This is similar to if you do not specify the \ after the TARGETDIR property ("[TARGETDIR]\"). I am putting the \ after the property in the custom data field, but it is the user input that causes the error. Is there a way to insure that the add the slash to the property if it is missing?
John E Bailey  Thursday, August 06, 2009 2:43 AM

Hi John E Bailey,

Based on my understanding, we do not need to have the users type the path correctly. We can correct the text after we get the text from the UI to make sure the path ends with a ‘\� This is a code snippet:
string path = GetPath();

//Add '\' if the path does not end with '\'

if (path.EndsWith("\\") == false)

path += "\\";

Please feel free to tell me if I misunderstand you.

Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Friday, August 07, 2009 9:23 AM

Hi John E Bailey,

Based on my understanding, we do not need to have the users type the path correctly. We can correct the text after we get the text from the UI to make sure the path ends with a ‘\� This is a code snippet:
string path = GetPath();

//Add '\' if the path does not end with '\'

if (path.EndsWith("\\") == false)

path += "\\";

Please feel free to tell me if I misunderstand you.

Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Friday, August 07, 2009 9:23 AM

You can use google to search for other answers

Custom Search

More Threads

• WSUS 3.0 failed remote SQL
• Click Once Deployment Using Publish Feature of VS 2005
• VS2008 Setup & Deployment Requires .NET 3.5
• Repair option in setup project
• FileIOPermission in WinControl hosted in IE
• ClickOnce Application
• Clickonce Downloading and Installing on Client's PC
• absent of ServiceProcessInstaller
• Deployment Environment Scenario
• Differentiating between multiple running instances of same ClickOnce app