8

I have a WPF application with 3 projects to represent a 3-layer architecture. One project is set as the main project. I have some XML files in one of the non-main project. These XML files are accessed by functions defined in classes of that project.

When I try to publish the application using VS2010 ClickOnce, the XML files are not included in the installation file even after marking the files' Build Action to Content and Copy-to-OutputDirectory as Copy Always. When running the installed application, the application reports that the files are not found. I can see an Application_Files folder in the installation folder generated by ClickOnce, but it does not contain the XML files.

So, my question is how can I include the XML files in the installation folders and also get their location URL while running the application.

Thanks, Naveen

Update 1: The application solution structure consists of three projects, say P1, P2, and P3. P3 is the main startup project. P1 and P2 are class library projects. The XML files are added to the P2 project. The files are marked as Build Action -> Content and Copy -> Copy Always. However, these files are not copied to the application's data folder by ClickOnce while publishing the application.

0

2 Answers 2

6

Simple Solution. Right click on yo project file which you want to publish. Select properties. Then select publish in the opened window. Click on Apllication files button. There, find yo .xml file, which will of type 'Data file' by default. Change it to Include. Save Rebuild and publish and thats it.

Hope it helps someone in need of it.

1

there a 2 locations clickonce uses:

  • a location for the main executable and all necessary dll's
  • a location for everything that isn't executable, i.e. resources, like your xml

so you have an application directory and a data directory. Addressing the application dir can still be done like this AppDomain.CurrentDomain.BaseDirectory.

But if you want to address the data dir, you need something specific for the clickonce: ApplicationDeployment.CurrentDeployment.DataDirectory.

I'm not sure if you have checked that data dir, because you haven't mentioned it in your post.

1
  • 1
    Thanks. I tried giving the data dir addressing. But the issue seems to be that the XML files themselves are not being copied while publishing the application. If I have the XML files under the main project they will be copied into the folder created by ClickOnce. But my XML files are not in the main project; they are added to the non-main project. I checked the folder with the setup file but couldn't find any of my XML files there.
    – naveen
    Apr 5, 2011 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.