ClickOnce : Avoid deploying large files that never change

651 Views Asked by At

I have a large click-once application that uses a 3rd party software "DevExpress". The DevExpress DLLs comprise of 95% of the size of my application. They never change but every time I deploy an update I need to upload them to my FTP server, this take a while to do. Is there a way to have a separate package that is linked this my click-once application for the DevExpress Files ?

Note: On the client side, click-once manages this efficiently and doesn't download files that haven't changed.

Thanks

1

There are 1 best solutions below

0
On

You can localize the assemblies, which is sort of like putting them in the GAC, only they will be buried into the %USERPROFILE% folder (with other ClickOnce assemblies).

You do this by declaring them in your App.Config file, and then within the project set each of the assemblies to "Exclude." Here is a snippet of what your App.Config will need to look like:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="DevExpress.BonusSkins.v16.1" culture="neutral" publicKeyToken="B88D1754D700E49A"/>
        <codeBase version="16.1.4.0" href="http://YourUrl/DevExpress/16.1.4/DevExpress.BonusSkins.v16.1.dll"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="DevExpress.Charts.Designer.v16.1" culture="neutral" publicKeyToken="B88D1754D700E49A"/>
        <codeBase version="16.1.4.0" href="http://YourUrl/DevExpress/16.1.4/DevExpress.Charts.Designer.v16.1.dll"/>
      </dependentAssembly>

The first time the click-once deployment runs, it will check if the files are localized. If so, it will use them. If not, it will download them once (and only once).

Advantages:

  • Your Click-once deployment (exe) is now really small
  • You can add all the awesome Dev Ex assemblies you want, like Bonus Skins, without worrying about making your deployment huge
  • This works for any signed DLL, not just Dev Express
  • Just like Click-Once, the user does not need admin rights to do this (with the GAC solution, he will)
  • Updates to your app will be FAST FAST FAST
  • Totally transparent to the user. It all happens silently on the initial install

Disadvantages:

  • You have to manage the App.Config when you upgrade
  • It is per-user, so if six users log on to the same machine, you're copying the DLLs six times

This also works with a UNC path -- you don't need a Web reference if your users are all internal.