none
Installation Location RRS feed

  • Question

  • Hello,

    I've got a VB.NET click once application that I would like to call from a separate application.  The problem I'm having is finding the location of my click once application.  Since it installs in the cache, it's really hard for me to predict exactly where the application installed.  The folder name seems to have a lot of variablitiy as well as there being older versions of the .exe file in the same cache.  It could also be installed in a different folder for a different user on the same machine.  So, what I'm really looking for is a systematic way to determine the path of my installed click once executible.  I'm guessing I'll also need to be able to tell what the user's name is too in order to pick the correct folder.  Hope this makes sense.

    Thanks!
    Thursday, March 4, 2010 10:21 PM

Answers


  • Here's how to *find* the shortcut on the start menu:

     

    shortcutName =
                      string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs),
                        "\\", publisher_name, "\\", product_name, ".appref-ms");

    You have to know the publisher_name and product_name from the ClickOnce deployment.

    You can do a System.Diagnostics.Process.Start(shortcutName) to run it.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by eengel821 Monday, March 8, 2010 11:52 PM
    Sunday, March 7, 2010 7:02 AM
    Moderator

All replies

  • Yes, and the install location can move too if roaming profile is enabled. Why you need the location, anyway? Just get the running exe path and do some modifications. Visit the CLR forum if you need help to get the running assembly's path.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    Thursday, March 4, 2010 11:35 PM
  • The reason I'm looking for the path of my executible is because I have a .dll that is handling the windows explorer context menu.  When the user clicks my menu option, I'm wanting my click once application to open, but I'm having a hard time locating the path the the executible.  Should I still post it in the CLR forum?

    Thursday, March 4, 2010 11:47 PM
  • mmm, no, since this is about a design problem. You need to inform a shell extension the location of your clickonce app. If the shell extension is written by yourself, I suggest you to visit the microsoft.public.platformsdk.shell newsgroup. Otherwise I suggest you to talk to the guy who wrote the menu extension to brainstorm out some protocol between you.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    Friday, March 5, 2010 12:48 AM
  • Hi eengel,

    ClickOnce is designed to let user install without aware of its location.
    For Windows XP/2003, it locates under the sub folder of [System Partition]:\Documents and Settings\[User Name]\Local Settings\Apps\2.0

    For Windows Vista/2008/7, it locates under the sub folder of [System Partition]:\Users\[User Name]\AppData\Local\Apps\2.0

    There is no system API to get that path. If your application .exe file has a unique name, you can search through that path’s sub folder to find it.

    Sincerely,
    Kira Qian
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework!
    Friday, March 5, 2010 9:12 AM

  • Are you just trying to run the application, or do you *have* to run the exe file? Can you call the shortcut on the start menu instead? If so, I can post back the code for doing that.

    Note that if you run the ClickOnce application by running the executable, it does not run as a ClickOnce application. It won't verify that the files have not been tampered with, and it will not check for updates.

    I'm assuming your ClickOnce app is a desktop application or console app -- is this the case?

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Friday, March 5, 2010 10:26 AM
    Moderator
  • Hi RobinDotNet,

    It is just a fairly simple desktop application.  I'm really just trying to run the application, so if I don't have to call the .exe directly I would be happy to try that.  I did attempt to call the Start menu shortcut without success, but I probably did it wrong.  If you have an example of how to call a shortcut menu that would be preferred as I would like it to check for the updates as well.

    Thanks! ... and also thanks to the other posters for your help as well.
    Friday, March 5, 2010 6:44 PM

  • Here's how to *find* the shortcut on the start menu:

     

    shortcutName =
                      string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs),
                        "\\", publisher_name, "\\", product_name, ".appref-ms");

    You have to know the publisher_name and product_name from the ClickOnce deployment.

    You can do a System.Diagnostics.Process.Start(shortcutName) to run it.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by eengel821 Monday, March 8, 2010 11:52 PM
    Sunday, March 7, 2010 7:02 AM
    Moderator
  • Thanks for your reply.  So I'm seeing another level of complexity that I'm dealing with here.  The application I'm using to call my ClickOnce application is actually written in VB6 and not .NET (It was too difficult to convert to .NET).  Do you know if there is a similar process in VB6?

    Monday, March 8, 2010 5:57 PM
  • Sorry, I haven't done VB6 in years. I recommend you post to a VB6 forum or discussion group or google it or something. You basically need to figure out the path to Start / Programs, and then you can concatenate the rest of the path on there.

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Monday, March 8, 2010 11:04 PM
    Moderator
  • OK i'll try that.  Thanks for all the help.
    Monday, March 8, 2010 11:52 PM