Getting a WPF desktop application deployed from a web server like IIS 7 using a ClickOnce package isn’t a walk in the park I’ve noticed. There are tons of little gotcha’s that stand in the way of your automated ClickOnce application generating script and tips to solve those issues are scattered around the web.
Here’s a list of the tips I found and needed to get a working package deployed:
- To be able to download the ClickOnce package from a web server, the .deploy extension on the package’s files is used to make sure IIS doesn’t block the download because the types are not allowed or unknown (like dll’s, exe’s config files etc). This is to avoid having to add all those file types to the exceptions on the handlers in IIS, which would be a bad idea anyway as you don’t people to be able to download your ASP.NET dll’s anyway. If you don’t have .deploy, you’ll get “file not found” errors from IIS because it refused to allow the file to be downloaded.
- If you keep getting an error about the application’s entry-point when you download the package, check if your build output has binaries for a mix of platforms. All references should be “msil”. If you see a mix of “msil” and “x86” for the executable or one of its assemblies that could be the issue. You can see that in your manifest file. Fix this by correcting all projects’ build settings in the solution’s configuration manager in Visual Studio.
- Mage.exe has its limits. Some of the settings in the application file you’ll need to script yourself. For example the auto-update settings, or the mapFileExtensions to download .deploy files. The PowerShell XML type accelerator is great for this.
- Make sure no manifest or application files are already in the folder you use to create your ClickOnce installer before running Mage. It will result in a non-working installer.
- Some general troubleshooting tips.
- You can find some more tips here.
Photo by Hugo Chinaglia, cc-licensed.