Installing a ClickOnce Application for all users

I gave a talk in Mountain View at the South Bay .Net User Group meeting on August 5th. This was a general talk about ClickOnce Deployment and how to use it. Almost everyone in the room was a Windows Forms or WPF developer, which seems rarer and rarer these days as people migrate to web applications. There were a lot of questions, and a lot of good discussion about things that people would like changed in ClickOnce deployment.

The most frequently requested feature in that meeting and in the MSDN ClickOnce Forum is to install a ClickOnce application for all users rather than a specific user.

This is difficult because the files are stored in the user’s profile, where the user has read/write privileges. One of the design goals of ClickOnce is to provide a deployment technique that allows customers to install applications without elevated privileges. Installing an application for all users requires privileges.

Another design goal was to protect the client machine from problems caused by software installations. Do you remember “dll hell”? This was the problem that happened when another application came along and replaced a dll that you were dependent on, and caused problems for your application, or vice versa.

In a ClickOnce deployment, it is possible to include most of the dll’s locally with the deployment, rather than installing them in the GAC or the windows system directory. (This is excluding, of course, the .NET Framework and other prerequisite applications such as SQLServer Express.) You can even deploy the SQL Compact Edition dll’s or DirectX dll’s. This allows you to maintain strict version control on the dll’s that you include in your deployment. Microsoft would have to figure out a way to handle this if the application were deployed for all users; if they weren’t careful, you could easily end up in dll hell again.

On the other hand, if they just chose to put the files under the All Users profile, once again you have the permissions problem that Microsoft sought to handle with ClickOnce deployment, because the user can’t write to those files without elevated privileges. Also, If Microsoft stored the deployed files in the “All Users” folder, they would have to figure out what to do if UserA was logged on using the application, and then UserB logged on and there was an update available. Do you kick off UserA? Do you forego the update because UserA is already running the application? What is UserA always leaves his account logged on? How will you ever do an update?

This request has been passed on to Microsoft, but I haven’t heard of any plans to include a change to this in .NET 4.0, so I wouldn’t expect any quick results. Doing an all-users install is counter to the design goals of ClickOnce deployment, so I think it’s going to be something everyone has to live with, at least for now. Using XCopy or a setup & deployment package and rolling your own incremental update methodology would be the way to go if you absolutely have to have an All Users installation.

Tags: ,

13 Responses to “Installing a ClickOnce Application for all users”

  1. Ed Multare Says:

    Please, can you tell me…
    How to create an DVD auto installer where can put…
    . Windows Application Installar (setup.exe and msi)
    . Windows Installer redistribuible
    . NET FW 3.5 SP 1 resdistribuible
    . SQL 2005 Express redistribuible

    Here in Argentina, yet every work with Windows application. Here Internet Connections are some slow.
    Web applcations are growing slowly.

    I put Prerequisites but I get errors As that the Installer project does not find the redistributions packages .

    Sory my english
    Thank in advance.
    Ed

    • robindotnet Says:

      I don’t know much about Windows Installer, my area of expertise is ClickOnce deployment. I know you posted in the MSDN Forum for ClickOnce and S&D, but I can’t find the posting. Can you either go and post a bump to it so it rises to the top, or post the link back here? I might be able to find you an answer.

  2. Warwick Fahrenhorst Says:

    Thank you for your article. I have a few queries regarding ClickOnce deployment. Does Microsoft plan to include the All User installation for Click Once? And if so, do you know when this may happen?

    Thank you in advance.

    Kind regards,
    Warwick

    • robindotnet Says:

      Hi,
      I don’t believe this is something Microsoft will change. It is one of the underpinnings of ClickOnce, and would require a complete re-architecture. I’ve given them a lot of feedback over the past year, and they are listening, so who knows what will happen. Maybe they will create something new that is the best of ClickOnce with the most frequently requested changes implemented. We’ll have to wait until VS2012 (or whatever the next version is) to find out…
      Robin

  3. Ed Says:

    Ok. I will wait news.

    • Carlos Says:

      Hi Ed.
      You can read about WiX (Windows Installer XML), it’s a open source utility..

      Cheers… from MX

  4. Andy C. Says:

    Hi Robin. Thank you for your blog. I’d like to ask if there are any updates or hacks around the “All Users” problem available right now. We are able to run an MSI as an admin one time and would like the ClickOnce app to be available for all users. Could it be possible to install the app with an MSI and update via ClickOnce?

    • robindotnet Says:

      Hi Andy. Because of the design goals of ClickOnce, this is just not possible. They would have to completely rewrite ClickOnce in order to add the capability to install an application for all users on a machine. If this is a showstopper feature for you, you’re stuck with setuip & deployment packages.

      • Andy C. Says:

        Thanks. Can I run this one by you? What if we use an MSI to install the ClickOnce deployment resources on the local machine and a desktop shortcut for all users that points at the local deployment manifest? All users would see the shortcut, and the application would install when they clicked on it. Would that setup work? I know we’re not installing for all users (each will still have to install), but it seems like a straightforward way to make advertise for all users.

  5. Joseph Says:

    Hi Robin,
    I have a click once application that talks to WCF service on a different server. I downloaded the ClickOnce Application locally, and went to the application folder and clicked on the exe and the login screen comes up.
    After deploying when I made the deployed path shared and click the exe I get the following error : “Insufficient permissions for setting the configuration section ‘defaultProxy'”. Any idea what is happening in the background and why this permission issue is coming up because I am the same user that downloaded the application. What would change when I do it from a shared path. Please bear with me as I am new to the security/privilege scenario.

    Thanks in advance,
    Joseph

    • robindotnet Says:

      I’m not sure why you posted twice, so I’ll respond to this one. I don’t understand what you are trying to do to the clickonce application or why you are marking the path shared. If you run the application by clicking on the exe, it does not run as a ClickOnce application. Are you doing that under the account you installed it for, or are you trying to figure out a way to circumvent the “click once deployment does not work for all users” restriction?

  6. Joseph Says:

    Hi Robin,
    I have a click once application that talks to WCF service in the back. When I launched the application, the files were deployed locally under my user profile. When I go there and double click the exe all works. But when I shared that the following error “Insufficient permissions for setting the configuration section ‘defaultProxy'”.
    I am bit new to the security/privileges thing. Can you tell me what happens here. Because I am still logged in as the same user when I am doing this. Once works and one does not.
    -Joseph

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: