Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are getting that path because it's the one used by ClickOnce. ClickOnce applications are installed under the profile of the user who installed them.</p> <p><strong>Edit :</strong></p> <p><strong>Method 1:</strong></p> <p>Here's a way to get the path where your application was installed from (works only if your application was installed) (parts of this were written by <a href="https://stackoverflow.com/a/8810355/162671">@codeConcussion</a>) :</p> <pre><code>// productName is name you assigned to your app in the // Project properties -&gt; Publish -&gt; Publish Settings public static string GetInstalledFromDir(string productName) { using (var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall")) { if (key != null) { var appKey = key.GetSubKeyNames().FirstOrDefault(x =&gt; GetValue(key, x, "DisplayName") == productName); return appKey == null ? null : GetValue(key, appKey, "UrlUpdateInfo"); } } return null; } private static string GetValue(RegistryKey key, string app, string value) { using (var subKey = key.OpenSubKey(app)) { if (subKey == null || !subKey.GetValueNames().Contains(value)) { return null; } return subKey.GetValue(value).ToString(); } } </code></pre> <p>Here's how to use it :</p> <pre><code>Uri uri = new Uri(GetInstalledFromDir("ProductName")); MessageBox.Show(Path.GetDirectoryName(HttpUtility.UrlDecode(uri.AbsolutePath))); </code></pre> <p><strong>Method 2 :</strong></p> <p>You can also try </p> <pre><code>System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ActivationUri </code></pre> <p>But I think this one works only if your app was installed from the internet</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload