MEF-based application deployment with a click of the mouse

I have an application that is a shell with a bunch of MEF parts. Although the user can add new parts of MEF in some special places in their file system, the application itself needs to deploy about 5 or 6 of these libraries to work properly. I would like to use click-once for deployment. What is the best way to do this?

The simplest thing I could come up with was just to link the DLL in the IDE and mark it as content. Then they will be deployed. This means hard-coded file paths (debug / release, etc.). Therefore, there seems to be a better way.

The second order is to copy the newly built versions of the MEF dll into the shared directory and always refer to them in the project and mark them as “content”.

I saw a link to creating a redistributable in another question ( Deploying MEF Parts ). A possible solution there is like copying everything into a directory, zipping it up and then unpacking it on the client, which is basically what an explicit link as "content" will do in my idea above (I think).

Other options? Thank you very much in advance!

+6
source share
1 answer

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

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

I finished creating a dummy Visual Studio solution called My ClickOnce Application - prerequisites . As part of this project, I added all the third-party dependencies that were needed for my application, and I added the MSI installer project, which installed the libraries in the Windows GAC. After creating the MSI installer, I created a bootloader and added it to Visual Studio for ClickOnce

From my ClickOnce application project, I only needed to select a new condition in Visual Studio and set “prerequisites” for each of the related DLLs from the “Application Files” dialog box in VS.

I think such a setting might work for you. For more information about this type of setup, see the links below. The only serious fall in this approach is that if you need to update a third-party library, you will need to distribute an updated version of the precondition. This would most likely mean and remove and reinstall your ClickOnce application, since the library files are installed as prerequisites.

additional literature

+1
source

Source: https://habr.com/ru/post/900428/


All Articles