ClickOnce and ReportViewer

Update: As commented by Jeff below, this solution will not work for ReportViewer 2012.  Please see his comment for more details.

In my previous blog post I talked about  my initial struggles with ClickOnce and the .NET 3.0 framework.  After overcoming the initial issues, I was trying to test deploying the application on a client machine without the .NET framework installed.  So I created an XP Pro virtual machine in VMware, and installed all of the high priority Windows updates, carefully avoiding the .NET frameworks (which are all available as optional updates).
Since the framework wasn't installed, I clicked the button to Install the prerequisites, which worked well for a while.  It downloaded the .NET 3.0 Framework and the ReportViewer.   It installed the framework.  But when it tried install the ReportViewer, the following dialog appeared with the interesting message "Setup has detected that the file ...\ReportViewer.exe has changed since it was initially published.":
ClickOnce Install Version Mismatch
After some head scratching and Google searching, I had a theory as to what was causing this issue.  When publishing a ClickOnce application with prerequisites, you can choose for the client to download the prerequisites from the "component vendor's web site" or a known location that you specify (either by an absolute location, or in the same location as the ClickOnce installation files.)  I had chosen to download the prerequisites from the "component vendor's web site".
Based on information on the web, I knew there was a new version of the ReportViewer control released with VS.NET Service Pack 1, and a subsequent update (quite confusingly called Report Viewer 2005 Service Pack 1) to fix things they broke in the VS.NET SP 1 version.   So my theory was that the version it was downloading from the web did not match what I had on my local machine (and thus what the installation was expecting).
So I first bit the bullet and installed the Visual Studio Service Pack (which I'll rant about in a separate post).  And then I downloaded the subsequently updated ReportViewer.  To get it to be published, I needed to copy the ReportViewer.exe to the correct Bootstrapper folder, which on my machine is: C:\Program Files\Microsoft.NET\SDK\v2.0\Bootstrapper\Packages\ReportViewer as described in a previous post.  And sure enough, when I did this and published the application again, it was able to install both the .NET framework and the ReportViewer control on the client.
This seems like a potential issue with choosing the "component vendor's web site" to get prerequisites.  If you choose this option and the vendor updates the item to a newer version than what was on the machine when you published the deployment, it will fail to install.  Seems like the better route is to choose one of the options to install prerequisites from a known location.

5 comments: (+add yours?)

rick said...

I tried yoru suggestion but had no luck. Instead I simply included the report viewer files by pushing the application files button under the publish TAB of the project. I put the drop down on Include for the following:

Chris Pauly said...

We just had the same problem because we also use the component vendor's web site download option.

It only was happening on one computer, so we didn't want to change our publish to fix it.

We fixed this by cleaning up the temporary files on that machine. You can run cleanmgr.exe to get an easy UI to cleanup temporary files and folders.

Anonymous said...

i had the same problem but also had the problem with crystal reports. i downloaded the crystal reports clickone instller and it worked perfect on a second machine.

UJ student

InteXX said...

Alas this solution will no longer work for ReportViewer 2012. Note these cautionary words:

"Make sure that the Download prerequisites from the component vendor’s website option is checked. This is the only supported option."

It appears that the solution lies in the package's public key. This advice worked for me:

Jeff Bowman

Joe Wirtley said...

Thanks for the update Jeff!