Deploy my DLLs to GAC for use with ClickOnce App

2019-02-13 14:14发布

问题:

How do I do it? Is there any reason I shouldn't?

I have a winform ClickOnce App that has about 13mbs in DLLs that are not mine so I would have no need/ability to update them at any regular intervals.

DevExpress(3), Microsoft ReportViewer, Microsoft SQL Replication. Microsoft SQL SMO.

Without them being included in my ClickOnce App my whole program comes in at about 1.5mbs and with our remote sites having limited vpn connectivity I really need to get it down there. I can't send 15mbs across our network to all users everytime I make a minor app change.

Thanks


UPDATE FOR CLARITY

For clarification; I do not want to install my DLLs to the GAC with ClickOnce. ClickOnce is what my main app needs to use. I want to remove that 13mbs of DLLs from the ClickOnce App and get them installed for use on all the local systems.

If I can accomplish this with out the GAC, fantastic. I just need my main app trimer so updates.

回答1:

Expanding on @kanad's response...

Your 13MB of dlls will only be downloaded by users the first time they install the application. That's one of the big advantages of ClickOnce, users only have to download files that have changed.

However, the confusing thing is that the ClickOnce progress dialog always shows the entire size of your application even though it may not be downloading the entire application. I did extensive testing to make sure this was the case and proved it to myself using a bandwidth monitor.

Finally, if you have control over your web server you might want to consider enabling compression for your ClickOnce applications. It helps reduces the download size considerably. Compression is kind of a pain to set up, but this article should get you started. However, once again, the compressed size is not reflected in ClickOnce progress dialog.

The best thing to do is just ignore the number that shows up on the ClickOnce progress dialog :)



回答2:

Clickonce can't install files into the GAC. You'd need to create an MSI or elevated privileges to do it.

Generally you should avoid the GAC unless it solves a specific problem. Is the install size more of a pain than the ClickOnce download- are users using 50K modems, or a high speed LAN?

Chris Sells has a great article on why you should avoid the GAC, and there are various other stack overflows posts on it- see here, here and here.

At the end of the day you need to evaluate the pros and cons and decide what is the best course of action.



回答3:

Here is what I have done in past and it was worked well for me. I have the ClickOnce app look for some of these dependences in the GAC. In fact it checks every time the application loads. I use a simple file exists to see if the dependences are in the GAC. If the dependence is missing I display a message that you are missing some dependence and some instructions on how to fix it. Then I shell out and download a self extracting exe that installs the dependences in the GAC. It is a little Rube Goldbergen, but it has worked surprising well for me.

I would only put things in the GAC that are going to be static for the foreseeable future 3rd party controls etc.

I have a pretty fat client that includes MS Reporting, Infragistics, and SMO among others that we deploy one a week or so that is roughly 3.5MB. Many of our uses are very remote and use data cards you internet access.



回答4:

Although the other answers are correct, in that ClickOnce will only download DLLs once (if they have not changed) to address your direct question, if you will be installing dlls into the GAC outside of the ClickOnce process and don't want to download these DLLs via ClickOnce at all you can do the following.

Exclude those DLLs from the ClickOnce download by setting them to prequisite within the ClickOnce->Application Files settings.

When you do this, the ClickOnce runtime will check the GAC before download and make sure those DLLs exist.



回答5:

According to Google no and no here too.

You would have to look into alternative installer tools such as creating an MSI installer. It sounds strange, but my first idea to tackle install size would be to have two installers. One to install dependencies into the GAC that the users only have to run once, and another installer (that I guess could use ClickOnce) to install the actual application. Using this method, you could theoretically rely on the smaller ClickOnce deployment for all future app updates.



回答6:

How do you know if everytime it downloads the full 15 MB. The clickonce dialog box always says that but it doesn't actually download all the files only those whose hash has changes in the manifest. That given there is way to deploy from a CD with a different URL for update check. This way you can install from a CD for the first time and from then on the app can update only itself from your published site.