Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Challenging ClickOnce problem... can't write to the data store
 

Challenging ClickOnce problem... can't write to the data store

Ok, I have a program whose solution is composed of (3) projects. I am using ClickOnce as my deployment method and have set the Security Zone to Full Trust.

My configuration.dll, which is one of the (3) projects compiled in my solution, tries to write a config.xml file to the ClickOnce data folder.
FYI: The file does not already exist, so it must create it on the fly.

The problem: It doesn't create it on the fly. It tries to write the file to the correct location but a check of that location reveals that the file is never created and thus cannot be written to.

Does this mean that I need to create a blank config.xml file and include it with the project at compile time? Can files not be created in the 'data directory' of ClickOnce applications?

How can I tell if this is a security zone problem, which I assume it is?

FYI: I do not sign the assemblies, could this be causing the problem? (I am having trouble signing the assemblies)

I have been wrestling with this problem for the last hour so any help, suggestions, and/or advice would be really welcome at this point. ;)

(If you need/want more info just ask, I am monitoring this post)
JBrown9264  Wednesday, August 03, 2005 9:57 PM
Are you trying to use IsolatedStorage or the DataDirectory?  If you are writing to the DataDirectory, then you'll need FileIO permissions.  If you're writing to the IsolatedStorage, then you will only need IsolatedStorageFile permissions, which you will usually have (even on the restricted Internet permission set), but you'll need to use streaming to read and write the file.

I found this out when I tried to make a test app to play with ClickOnce, and expected to just be able to do xmlDoc.Load to load in my configurations XML file.  But no, I had to create a stream and reader/writer pair with the correct file mode and access, and do something like

   xmlDoc.LoadXml(reader.ReadToEnd());

It may be a good idea to make a helper to simplify this bit.
JohnLudlow  Friday, August 05, 2005 1:04 PM
Are you trying to use IsolatedStorage or the DataDirectory?  If you are writing to the DataDirectory, then you'll need FileIO permissions.  If you're writing to the IsolatedStorage, then you will only need IsolatedStorageFile permissions, which you will usually have (even on the restricted Internet permission set), but you'll need to use streaming to read and write the file.

I found this out when I tried to make a test app to play with ClickOnce, and expected to just be able to do xmlDoc.Load to load in my configurations XML file.  But no, I had to create a stream and reader/writer pair with the correct file mode and access, and do something like

   xmlDoc.LoadXml(reader.ReadToEnd());

It may be a good idea to make a helper to simplify this bit.
JohnLudlow  Friday, August 05, 2005 1:04 PM

You can use google to search for other answers

Custom Search

More Threads

• VS2005 - Publish Succeeded but problems running application
• Installer.OnBeforeInstall
• System.Deployment.Application.InvalidDeploymentException on some machines
• ClickOnce upgrade notification issue for some users
• Can non-admins install application which creates event source on setup?
• Forcing and catching a SecurityException from IEExec
• Automatical uninstallation of my already installed program Options
• Could not load type from assembly
• deployment
• Has publishing changed in 2008? There's a now an Application Files Folder