Cannot find ApplicationDeployment in System.Deployment

I have a built-in program, and I'm trying to change the standard check for clickOnce updates with a hard-coded one. I added using System.Deployment;, but does not contain the assembly information I need to call. What am I missing here? I searched for MSDN, but it keeps saying that this is the correct namespace for the call.

The error is displayed as: The name ApplicationDeployment does not exist in the current context

Code from the program:

        private void UpdateApplication()
    {
        if (ApplicationDeployment.IsNetworkDeployed)
        {
            ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
            ad.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
            ad.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(ad_CheckForUpdateProgressChanged);

            ad.CheckForUpdateAsync();
        }
    }
+5
source share
2 answers

ApplicationDeploymentthe class is present in the namespace System.Deployment.Application, not System.Deployment. Change your usage accordingly or try with full nameSystem.Deployment.Application.ApplicationDeployment

+13
source

You need to add using System.Deployment.Application;.

+2
source

All Articles