From the user's point of view, ClickOnce applications can be launched in two ways: From a web page on the Internet, intranet or local computer. The web page includes a link to the application deployment manifest (. application), a click on which installs and launches the application on the user's computer.
With a project selected in Solution Explorer, on the Project menu, click Properties. Click the Publish tab. Click the Application Files button to open the Application Files dialog box. In the Application Files dialog box, select the Group field for a file that you wish to include in the new group.
Application reference file used by ClickOnce, a Microsoft platform used to deploy and run remote Web applications; contains a local or remote link to an application; commonly used to enable links from the Windows Start Menu.
To find the folder location, you can just run the app, open the task manager (CTRL-SHIFT-ESC), select the app and right-click|Open file location.
path is pointing to a subfolder under c:\Documents & Settings
That's right. ClickOnce applications
are installed under the profile of the user who installed them. Did you take the path that retrieving the info from the executing assembly gave you, and go check it out?
On windows Vista and Windows 7, you will find the ClickOnce cache here:
c:\users\username\AppData\Local\Apps\2.0\obfuscatedfoldername\obfuscatedfoldername
On Windows XP, you will find it here:
C:\Documents and Settings\username\LocalSettings\Apps\2.0\obfuscatedfoldername\obfuscatedfoldername
ApplicationDeployment.CurrentDeployment.ActivationUri might work
"A zero-length string if the TrustUrlParameters property in the deployment manifest is false, or if the user has supplied a UNC to open the deployment or has opened it locally. Otherwise, the return value is the full URL used to launch the application, including any parameters."
BUT what I think you really want is ApplicationDeployment.CurrentDeployment.DataDirectory which gives you a folder you can write data to. When you update the application anyways you'll lose what was in the original .exe folder, but you can migrate the data directory over to a new version of the app. Your app can write to this folder with whatever log files it has - and I'm pretty sure its guaranteed to be writable.
I'm using Assembly.GetExecutingAssembly().Location
to get the path to a ClickOnce
deployed application in .Net 4.5.1.
However, you shouldn't write to any folder where your application is deployed to ever, regardless of deployment method (xcopy, ClickOnce, InstallShield, anything) because those are usually read only for applications, especially in newer Windows versions and server environments.
An app must always write to the folders reserved for such purposes. You can get the folders you need starting from Environment.SpecialFolder Enumeration. The MSDN page explains what each folder is for: http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx
I.e. for data, logs and other files one can use ApplicationData
(roaming), LocalApplicationData
(local) or CommonApplicationData
.
For temporary files use Path.GetTempPath
or Path.GetTempFileName
.
The above work on servers and desktops too.
EDIT:
Assembly.GetExecutingAssembly()
is called in main executable.
ClickOnce applications DO reside in a subdirectory of C:\Documents & Settings. They don't have "clean" installation directories because the local files are essentially "temporarily" downloaded to allow the application to run on the local PC and execution of the application is controlled from the ClickOnce server that they are deployed on depending on publishing settings (Checking for updates, version requirements, etc).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With