Here's what I found that worked for being able to get the deployed folder location of my clickonce application and that hasn't been mentioned anywhere I saw in my searches, for my similar, specific scenario:
- The clickonce application is deployed to a company LAN network folder.
- The clickonce application is set to be available online or offline.
- My clickonce installation URL and Update URLs in my project properties have nothing specified. That is, there is no separate location for installation or updates.
- In my publishing options, I am having a desktop shortcut created for the clickonce application.
- The folder I want to get the path for at startup is one that I want to be accessed by the DEV, INT, and PROD versions of the application, without hardcoding the path.
Here is a visual of my use case:

- The blue boxed folders are my directory locations for each
environment's application.
- The red boxed folder is the directory I want to get the path for
(which requires first getting the app's deployed folder location
"MyClickOnceGreatApp_1_0_0_37" which is the same as the OP).
I did not find any of the suggestions in this question or their comments to work in returning the folder that the clickonce application was deployed to (that I would then move relative to this folder to find the folder of interest). No other internet searching or related SO questions turned up an answer either.
All of the suggested properties either were failing due to the object (e.g. ActivationUri) being null, or were pointing to the local PC's cached installed app folder. Yes, I could gracefully handle null objects by a check for IsNetworkDeployed - that's not a problem - but surprisingly IsNetworkDeployed returns false even though I do in fact have a network deployed folder location for the clickonce application. This is because the application is running from the local, cached bits.
The solution is to look at:
AppDomain.CurrentDomain.BaseDirectory
when the application is being run within visual studio as I develop and
System.Deployment.Application.ApplicationDeployment.CurrentDeployment.UpdateLocation
when it is executing normally.
System.Deployment.Application.ApplicationDeployment.CurrentDeployment.UpdateLocation
correctly returns the network directory that my clickonce application is deployed to, in all cases. That is, when it is launched via:
- setup.exe
- MyClickOnceGreatApp.application
- The desktop shortcut created upon first install and launch of the application.
Here's the code I use at application startup to get the path of the WorkAccounts folder. Getting the deployed application folder is simple by just not marching up to parent directories:
string directoryOfInterest = "";
if (System.Diagnostics.Debugger.IsAttached)
{
directoryOfInterest = Directory.GetParent(Directory.GetParent(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).FullName).FullName).FullName;
}
else
{
try
{
string path = System.Deployment.Application.ApplicationDeployment.CurrentDeployment.UpdateLocation.ToString();
path = path.Replace("file:", "");
path = path.Replace("/", "\\");
directoryOfInterest = Directory.GetParent(Directory.GetParent(path).FullName).FullName;
}
catch (Exception ex)
{
directoryOfInterest = "Error getting update directory needed for relative base for finding WorkAccounts directory.\n" + ex.Message + "\n\nUpdate location directory is: " + System.Deployment.Application.ApplicationDeployment.CurrentDeployment.UpdateLocation.ToString();
}
}