Home All Groups Group Topic Archive Search About

ClickOnce - file cannot be found

Author
5 Jan 2007 9:27 PM
avanti
Hi,

I use ClickOnce to publish and install an application in the company. I

have a help file for the same in .chm format. It is part of the C#
project as a 'content' file. I also tried as 'embedded resource'. It
opens when the help link is clicked. The code looks like:


            string exeFileName = Application.ExecutablePath;
            string exeFileNameStub =
exeFileName.ToUpper().Replace(@"\Path", @"\");
            exeFileNameStub =
exeFileNameStub.Remove(exeFileNameStub.LastIndexOf('\\'));
            exeFileNameStub =
exeFileNameStub.Remove(exeFileNameStub.LastIndexOf('\\'));
            exeFileNameStub =
exeFileNameStub.Remove(exeFileNameStub.LastIndexOf('\\')+1);
            string helpFileNameAsPublished = exeFileNameStub +
@"Help-TCM.chm.txt";
            string helpFileName = exeFileNameStub + @"Help-TCM.chm";
            FileInfo helpFileAsPublished = new
FileInfo(helpFileNameAsPublished);
            FileInfo helpFile = new System.IO.FileInfo(helpFileName);
            if (!helpFile.Exists)
            {
                if (!helpFileAsPublished.Exists)
                {
                    MessageBox.Show("Help request cannot be actioned
because help file is missing - contact support!", "Help file is
missing");
                    return;
                }
                helpFileAsPublished.MoveTo(helpFileName);
                Help.ShowHelp(c, helpFileName);
            }
            Help.ShowHelp(c, helpFileName);


It works fine locally. However when someone installs it from the
publishing link, I get the error "Help request cannot be actioned
because help file is missing - contact support!"


How can I make sure the .chm file is availabel when someone installs my

app?


Thanks,
Avanti

AddThis Social Bookmark Button