The ClickOnce application, when launched from the Start menu, receives the URL originally downloaded from

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;
    //Error getting the URL so put question mark
}

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".

+3
source share
3 answers

ApplicationDeployment.UpdateLocation . URL- → → → Visual Studio, URL- .

+1
ApplicationDeployment.CurrentDeployment.ActivationUri

, " URL " " ".

ApplicationDeployment.CurrentDeployment.UpdateLocation!

+7

, , , URI -, , , .

+1

All Articles