Fun with ClickOnce and XML files…and Prerequisites

I have a recent WPF project that is published using ClickOnce. However, the application has some XML templates that weren’t being copied over to the install directory. It was strange because they were being published to the deployment package. What I found was that in Visual Studio, you need to open Properties > Publish and click on the Application Files button.

Find the files that aren’t being copied over and change the Publish Status to “Include”. Mine were originally set to “Data (Auto)” and that didn’t cut it:

Incidentally, within the Solution Explorer, each file has its Build Action set to Content and Copy to Output Directory is set to Copy always.

An update: Don’t forget to deal with prerequisites – in my case, .NET 4.5 and the Visual C++ 2010 Runtime – x64. We had three developer machines where installation worked fine and client machines where it didn’t. I installed a fresh copy of Win7 in a VM and was able to fairly quickly determine this. To Microsoft’s credit, you can create a setup program to install prerequisites. However, IIRC, you get to download and install them even if they’re already installed. Still, better than beating your head against it all day. Cable broadband is a lot cheaper than my mental bandwidth.