Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying a MEF based application with click-once

Tags:

mef

clickonce

I've got an app that is a shell with a bunch of MEF parts. While the user could add new MEF parts in some special locations in their file system, the app itself needs to deploy with about 5 or 6 of these libraries on its own to work correctly. I'd like to use click-once to do the deployment. What is the best way to do this?

The simplest thing I could come up with was just to reference the DLL's in the IDE and mark them as content. Then they would be deployed. That means hard-coded file paths (debug/release, etc.). So it seems like there should be a better way.

Second order is to copy just built versions of the MEF dll's to a common directory and always reference those in the project and mark them as "content".

I've seen a reference to creating a redistributable in another question (Deploying MEF parts). The eventual solution there looks a lot like copy everything to a directory, zip it up, and then unzip on the client - which is basically what explicit reference as "content" would do in my idea above (I think).

Other options? Many thanks in advance!

like image 574
Gordon Avatar asked Oct 31 '11 12:10

Gordon


People also ask

How do I deploy one click application?

In the Specific target page, select ClickOnce. Enter a path or select Browse to select the publish location. In the Install location page, select where users will install the application from. In the Settings page, you can provide the settings necessary for ClickOnce.

What is ClickOnce deployment?

ClickOnce is a deployment technology that enables you to create self-updating Windows-based applications that can be installed and run with minimal user interaction.

Is ClickOnce still supported?

ClickOnce and DirectInvoke in Microsoft Edge | Microsoft Learn. This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Does ClickOnce require admin rights?

ClickOnce-deployed applications are considered "low impact", in that they are installed per user, not per machine. Administrator privileges are not required to install these applications.


1 Answers

I have an application that accesses various third-party libraries. Initially when I released my application through ClickOnce it was around 22Mb in size and since it was the initial release, I had to post quite a few updates during the first few months that it was used by my user base.

This was to much data for some of my users who at that time had rather slow data connections. I had to find a better solution.

I ended up creating a dummy Visual Studio solution named My ClickOnce Application - Prerequisites. From within that project I added all of the third-party dependencies that were needed for my application and I added an MSI installer project that installed the libraries within the Windows GAC. After building the MSI installer, I created bootstrapper and added it to Visual Studio for ClickOnce

From my ClickOnce application project, all I had to do was select my new prerequisite in Visual Studio and set each of the associated dlls to be "Prerequisites" from within the Application Files dialog in VS.

I think such a setup may work for you. For more specifics for this type of setup, check out the links listed below. The only major downfall to this approach is that if you need to update the third-party library, you will need to distribute an updated version of the prerequisite. This would most likely mean and uninstall and reinstall of your ClickOnce application, since the library files are installed as prerequisites.

Further Reading

  • Adding Custom Prerequisites
  • The Bootstrap Manifest Generator
like image 136
RLH Avatar answered Oct 12 '22 21:10

RLH