ClickOnce is a great new feature in Windows application development that provides a simple application deployment and update model. While it isn’t the most comprehensive and robust solution, I find that it works for deploying and updating small scaled applications. However, I did find one issue that could easily be overlooked and cause your updates to fail.
In toying around with one of my applications, I began to receive the “DeploymentDownloadException” exception. Upon reading further into the details, I found that my IIS Server was returning the HTTP Error Code: 404 (file not found).
So I opened the project’s properties page to confirm the upload and deployment locations; they were fine. Then I launched FileZilla (ftp client), to view the directories and found that the Publish from VisualStudio had run successfully because the files had been uploaded.
Puzzled, I went back to the error dialog, and read the detailed error message again. I discovered that the .application file was not found and couldn’t begin to understand why it wasn’t uploaded.
Because the updates for this particular application had worked fine before, I knew that it must be something involving my last actions. So, what was my approach to solving this issue you ask?
Well, to use the highly effective and scientifically mystical “think back or re-trace your steps” method of course.
By default, the Publish Wizard in VisualStudio saves ClickOnce applications with the .application extension appended. However, the Publish feature in the Properties dialog allows you to save the application files with a .deploy extension. Well if you publish your application using the Properties dialog with the “use .deploy extension” option checked, and then publish a later revision using the Publish Wizard, then on attempting to update the application, the server will return an HTTP 404 error. This is because your original dll has the .deploy extension appended to it and not the .applicatIon extension that the Publish Wizard added.
The solution…this is really tricky, so pay close attention:
Don’t combine the publishing methods. If you use the Publish Wizard to start, always use it; if you use the Properties form with the “use .deploy extension” selected, then always use the properties form.
Oh, and to fix and existing issue, simply published again using the original method and the application will be back on track.