ClickOnce and XML files not being published by Visual Studio
I was recently doing a deployment of a non-browser hosted WPF application. It contained some XML files used as data. I used the Publish wizard in VS and ran my application. It blew up and, after debugging, I realized that my XML files hadn't been deployed. I had specified them as "Content" to "Copy Always" which worked fine when compiling but clearly didn't do the trick when publishing. I poked around in the SDK and found an entry about deploying data files as XML, which made me realize that special things were happening as a result of the .XML extension. After trying to follow its instructions to use the mage tool in the SDK, I was still not successful. However, I did find a handy post on the MSDN forums, that explained thusly:
Xml files are published, by default, with the application. However, they are marked as data files by default. This means the xml files are published to the data directory. (The data directory is defined as System.Deployment.Application.ApplicationDeployment.CurrentDeployment.DataDirectory.) The advantage to having the file deployed to the data directory is that the file can be upgraded from one version to another.
However, if you don't need the upgrade capabilities, then you can set the xml file as Publish Status to 'Include' rather than 'Data File'. The Publish Status of a file can be set on the Application Files dialog. The Application Files dialog is accessed from the Publish Property Page.
I did as explained in the 2nd paragraph and, wallah, I was rockin' like Dokken. Thanks, Elizabeth Maher!
Comments
- Anonymous
March 10, 2006
I Want Free Stuff