Our users launch our ClickOnce WPF application from the Start / Desktop menu shortcut. When the application starts every time, we should get the URL from which it was originally downloaded. I tried using ActivationUri, but this only works when it was launched directly from the setup.exe site, and not from the desktop / start menu shortcut:
string activationUri = "???";
try
{
if (System.Deployment.Application.ApplicationDeployment.CurrentDeployment == null)
{
activationUri = "currentDeployment is null";
}
else if (System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ActivationUri == null)
{
activationUri = "deployment not null but uri is";
}
else if (System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ActivationUri != null)
{
activationUri =
System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ActivationUri.AbsoluteUri;
}
}
catch (Exception ex)
{
activationUri = ex.Message;
}
MessageBox.Show(activationUri);
When I start from the installation (from the website), I get the URL, and each time I get "deployment is not zero, but URI".
source
share