ClickOnce deployment - XML files not found

robertb_NZ

Well-known member
Joined
May 11, 2010
Messages
146
Location
Auckland, New Zealand
Programming Experience
10+
Summary: I am trying to use ClickOnce, but when I run my application a file seems to be missing. I can't see any difference from other files that are successfully deployed.

Detail: My application requires a number of application files that must be deployed with the compiled software. For example, ErrorHelp.txt, COBOL.jzc, Templates.xml, to pick out just three. There are about a dozen such non-compiled objects. They all have properties Build Action = Content, and Copy To Output Directory = Do Not Copy.

When I publish the application all these files are correctly put into the build as ErrorHelp.txt.deploy, COBOL.jzc.deploy, and Templates.xml.deploy, etc, and when I run the deployed application it runs in a way that would be impossible unless most of the files were available. However templates.xml appears to be missing. Everything was working perfectly using Visual Studio's debugger, but I needed to debug the application when it was run as a clickonce, so I added a Msgbox statement just before the program attempted to load templates.xml: -

MsgBox("Attempting to load templates from " & Source)
xmlTemplates.Load(Source)

The MsgBox displayed
"Attempting to load templates from <path>\templates.xml"​
("<path>" was the actual path to the application - long and involved and including something that looked like a GUID)

Using Windows Explorer I followed down this path and I found that the folder contained 17 objects, including ErrorHelp.txt and COBOL.jzc, but not \Templates.xml. I examined the corresponding file that had been created when the application was published and found 15 objects, including COBOL.jzc.deploy, ErrorHelp.txt.deploy, and Templates.xml.deploy. Objects without a corresponding .deploy object were Ftp.cdf-ms, Ftp.manifest, Jazz.cdf-ms, Jazz.exe.cdf-ms and missing objects were Templates.xml and FtpLicense.xml. (FTP is a third-party library that I have licensed for this application).

The two functions which depend on these xml objects don't work. Everything else seems to be OK. Everything (including these two functions) work OK with the debugger.

I'm also puzzled by the fact that if I publish the application with option "The application is available online only" it doesn't work at all, throwing message "Application cannot be started. Contact the application vendor". However if I use the option "The application is available offline as well" it works, albeit with the problems above. I don't know if this is a separate problem or part of this one.

I hope somebody can help me, because I've run out of ideas. I've tried to find the answer through MSDN and Google, but nothing leaps out at me.

Regards, Robert.
 
Build Action = Content, and Copy To Output Directory = Do Not Copy
Is this because you have already copied these files to debug directory?

Go to Publish tab in Application properties and click "Application Files" and review their status. An xml file will have default publish status as "Data File" and goes to application data directory, while a txt file will be "Include" and goes to application install directory.
 
Publish tab, [Application files]: both of the XML files had the default publish status "Data File(Auto)". I changed this to "Include" and republished the application. Now my application's [New] function, which is where the problem was occurring, works perfectly. A problem remains with FTP, but I think that this is unrelated.

Once I've sorted out the FTP problem I'll investigate the problem where "online only" doesn't work: if this problem remains I'll post it as a separate issue.

Thank you JohnH.
 
Back
Top