locked
Change installation folder for a Click Once App RRS feed

  • Question

  • Is it possible to change the installation folder for a Click Once application?  Currently, it installs to the client's "Documents and Settings\UserName" folder.  I'd like to put it in Programs or a custom location with our other apps.

    Thanks
    Sumit

    Wednesday, February 24, 2010 5:15 PM

Answers

  • Nope. You can't. One of the design goals of ClickOnce applications is that they require no administrative privileges, and the only places you can write with impunity on Vista and Windows Fabulous (7) are under the user's profile.

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by Aland Li Friday, February 26, 2010 7:30 AM
    • Marked as answer by RobinDotNet Wednesday, April 28, 2010 8:10 AM
    Thursday, February 25, 2010 12:18 AM
  • No, there's no way to locate the exe file easily. If you run the ClickOnce app with the exe file instead of the shortcut, it doesn't run as a ClickOnce application -- it won't check for updates, or make sure the files haven't been tampered with.

    If you want to run the ClickOnce application from another one, can you invoke the shortcut from the start menu rather than looking for the executable? 

                    shortcutName =

                      string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs),

                        "\\", publishing_company, "\\", product_name, ".appref-ms");

    Then you can do a process.start on the shortcutName.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by Aland Li Friday, February 26, 2010 7:30 AM
    • Marked as answer by Sumit J Friday, February 26, 2010 4:22 PM
    Thursday, February 25, 2010 8:35 PM
  • I'm not sure what you mean by locate the installation directory. Do you mean where it's installed on the user's machine? You can't run a clickonce app "remotely", i.e. by installing it on another machine and running it from there. It must be installed on the user's machine and it will install under the user's profile.

    You can put the deployment on a network share for the user to install from, but it's still going to install the files under his profile.

    There won't be a "fix" for this because it's not a bug. As noted above, one of the design goals of ClickOnce is to require no admin privileges, and the only place you can write with no admin privileges is under the user's profile.

    You can just copy your \bin\Release folder out to a shared folder and set up a shortcut for the user to point at the exe file. That will run from the server and install nothing on the user's machine. The performance of your application will, of course, be dependent on the network traffic and speed though.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by RobinDotNet Wednesday, April 28, 2010 8:10 AM
    Tuesday, April 20, 2010 12:00 AM

All replies

  • Nope. You can't. One of the design goals of ClickOnce applications is that they require no administrative privileges, and the only places you can write with impunity on Vista and Windows Fabulous (7) are under the user's profile.

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by Aland Li Friday, February 26, 2010 7:30 AM
    • Marked as answer by RobinDotNet Wednesday, April 28, 2010 8:10 AM
    Thursday, February 25, 2010 12:18 AM
  • Thanks RobinDotNet.

    Currently the application is being installed in some random folders created under user folder.

    C:\Documents and Settings\<USER>\Local Settings\Apps\2.0\EZ06VOEQ.ND0\1M37L8BD.662\beta..-dev_bdf509634bbb0d1f_0001.0000_1b0622813e3c509e

    Is there a way to control the name of the above folder (in the user folder) where the application should be installed?

    Thanks
    Sumit
    Thursday, February 25, 2010 3:00 PM
  • Hi Sumit,

    No, there is no way to control what folder the application is installed in. Why does this matter to you? Are you trying to reference the application in some way frmo another application or something?

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Thursday, February 25, 2010 7:39 PM
  • Hi,

    Yeah, I am planning to access the application trhough some other wrapper, which will look for the application exe file in certain location that I know beforehand.

    Do you know any other way to achieve this?

    Thanks
    Sumit
    Thursday, February 25, 2010 8:14 PM
  • No, there's no way to locate the exe file easily. If you run the ClickOnce app with the exe file instead of the shortcut, it doesn't run as a ClickOnce application -- it won't check for updates, or make sure the files haven't been tampered with.

    If you want to run the ClickOnce application from another one, can you invoke the shortcut from the start menu rather than looking for the executable? 

                    shortcutName =

                      string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs),

                        "\\", publishing_company, "\\", product_name, ".appref-ms");

    Then you can do a process.start on the shortcutName.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Proposed as answer by Aland Li Friday, February 26, 2010 7:30 AM
    • Marked as answer by Sumit J Friday, February 26, 2010 4:22 PM
    Thursday, February 25, 2010 8:35 PM
  • Thanks, RobinDotNet.
    Friday, February 26, 2010 4:22 PM
  • so from what I have researched, .net 3.5 sp1 does not permit the customisation of the installation location when using click once as a deployment and update mechanism.

    Use case is I have a preference to locate an installation directory on a network central locaiton (for example a home directoy) as opposed to the default user directories on the local machine.

    Is there a plan or a custom fix that is avaialble/will be available to acheive this in the near future or available today ?

     

    Monday, April 19, 2010 1:58 PM
  • I'm not sure what you mean by locate the installation directory. Do you mean where it's installed on the user's machine? You can't run a clickonce app "remotely", i.e. by installing it on another machine and running it from there. It must be installed on the user's machine and it will install under the user's profile.

    You can put the deployment on a network share for the user to install from, but it's still going to install the files under his profile.

    There won't be a "fix" for this because it's not a bug. As noted above, one of the design goals of ClickOnce is to require no admin privileges, and the only place you can write with no admin privileges is under the user's profile.

    You can just copy your \bin\Release folder out to a shared folder and set up a shortcut for the user to point at the exe file. That will run from the server and install nothing on the user's machine. The performance of your application will, of course, be dependent on the network traffic and speed though.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by RobinDotNet Wednesday, April 28, 2010 8:10 AM
    Tuesday, April 20, 2010 12:00 AM
  • Thanks Robin - you have answered the question - the use case scenario was in a citrix environment where we are looking at deploying a working native desktop application into a citrix farm using click once for initial deployment and daily updates. thank you.
    Tuesday, April 20, 2010 11:14 AM
  • Oh, yes, in a citrix environment, every time the user logs in (and gets a different terminal), they would have to install the application again. ClickOnce isn't really ideal for Citrix environments.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Wednesday, April 28, 2010 8:11 AM
  • Robin,

    Any answer for this...?!

    http://www.codeproject.com/Questions/871790/Net-Install-multiple-clients-of-the-same-applicati?arn=0

    Tuesday, February 3, 2015 7:00 AM