Troubleshooting ClickOnce deployment issues

August 25, 2007 9:18 pm

Over the last few days I ran into several puzzling ClickOnce deployment problems. I want to document and share these so that I’ll remember them better, and so others might find help with similar issues.

The first issue:
I uploaded new versions of my files several times, but every time I attempted to download the refreshed versions, no matter which computer I tried it on, all I got were old files. Ctrl+F5 in IE didn’t make a difference. Clearing the Internet Explorer history, cookies, temporary files didn’t make a difference. I even contacted my web host to see if they have any caching issues on the server side. In the end I stumbled across my installation of Fiddler, the HTTP debugging proxy. I looked at the raw HTTP dumps, and then I saw the issue: I’m behind an active caching proxy on my home network. The proxy was giving me old files all the time.
First issue solution:
Clean out the cache files on my proxy server. It happens to be squid, so this did it:

service squid stop
echo “” > /var/spool/squid/swap.state
service squid start

The second issue:
During the troubleshooting of the first issue I had started suspecting the ClickOnce caching system to be at fault. So I used “mage -cc” and “rundll32 dfshim CleanOnlineAppCache” to clean out the cache. No change. Then I started manually deleting files from the cache location on the hard drive. Bad mistake. Now I got weird deployment errors, talking about COM objects not being available, and “interesting” HRESULT errors: The referenced assembly is not installed on your system. (Exception from HRESULT: 0x800736B3). I uninstalled the .NET Framework 2.0 and 3.0 and reinstalled them. No change. Luckily I found an article on the MSDN forums that pointed me to a registry location to check out: HKCU\ Software\ Classes\ Software\ Microsoft\ Windows\ CurrentVersion\ Deployment. I checked it out and found a bunch of registry keys that I remembered seeing when I cleaned out the cache files before. So what would happen if I deleted all those keys? Maybe it would “reset” ClickOnce completely? Luckily it did.
Second issue solution:
Clean out both the ClickOnce cache files [C:\Documents and Settings\(User)\Local Settings\Apps\2.0] by hand (completely), and also clean out the registry keys under Components, Marks, PackageMetadata, StateManager\ Applications, StateManager\ Families and Visibility underneath HKEY_CURRENT_USER\ Software\ Classes\ Software\ Microsoft\ Windows\ CurrentVersion\ Deployment\ SideBySide\ 2.0

Caution! Your Mileage May Vary. Deleting registry stuff is dangerous! Make a backup first.

4 Responses to “Troubleshooting ClickOnce deployment issues”

Howard wrote a comment on September 5, 2007

Hi, maybe this is a newbie question but why does .NET require to increment the version number on everytime an application is deployed via clickonce? This is very annoying especially when I make a test version multiple times; but maybe there is some reasonable explanation. Why can’t .NET recognize the new files and without generating a new version number and filling the cache up?

GeekTieGuy wrote a comment on September 5, 2007

Good question. I can’t speak for Microsoft, so I can only give you my guess. It probably has to do with the complexity of checking timestamps/file contents and whatnot. Checking the version number is a well-defined, relatively reliable, non-ambiguous way of doing things. If you’re using Visual Studio, you can tell it to increment the version number automatically every time you publish your files, so it’s not too much of a headache for me personally. It doesn’t even have to be a major or minor version change, it can be all the way down in the revision group ( I’d ask the question on the Microsoft MSDN forums, if I were you.

Paul G wrote a comment on September 21, 2009

Thank you! It’s been driving me crazy for weeks. I have a click once application deployed to over 150 users, and over the last 2 years not a problem. All of a sudden, one by one, each started to fail on update with “The referenced assembly is not installed on your system” error. Funny thing is, there was no pattern to the failure or version at which the updates stopped. To top it off, the application refused to uninstall. IT support for this client is provided from overseas, so I think that they have been updating the .NET Framework version on individual machines. I build the app on Vista and it is deployed to Win XP. Anyway, clearing the Apps\2.0 cache folder, calling ClearOnlineAppCache (using the COM component available in the framework), clearing the Deployment registry key, and clearing the registry keys listed in solution #2 has solved the problem.

Leonardo Perez wrote a comment on November 12, 2009

Hello, i have just done everything explained here.. and it worked ( i had done a lot of things before i found this post, one of them was to remove my antivirus ). After i tested i began to install the things i had removed including my antivirus.. and IT HAPPEND AGAIN !!! … so in my case i uninstall and (again) clear the registry.. so my suggestions is that if u are using Clickonce.. stay away from avg antivirus ( free version in my case ).

Care to comment?

%d bloggers like this: