using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
using System.Deployment;

namespace RegisteryCheck
{
    class Program
    {
        static void Main(string[] args)
        {
            ApplicationDeployment ab = new 

            

        }
    }
}

Dani AI

Generated

The missing class is almost always an assembly/reference or deployment-context issue rather than a syntax typo. was on the right track about the deployment namespace, and correctly flagged the broken assignment — but two extra points are essential.

First, the ApplicationDeployment type lives in the System.Deployment assembly (the ClickOnce APIs). That assembly must be referenced by the project; otherwise the type won't resolve even with a using/import. Second, ApplicationDeployment is not instantiated with new — it is exposed by the runtime for ClickOnce applications. Access it via the provided static members and check the deployment state before calling instance methods. A safe usage pattern (fully qualified here to avoid adding extra using lines) looks like this:

if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
{
    var ad = System.Deployment.Application.ApplicationDeployment.CurrentDeployment;
    // ad.CheckForUpdate(); ad.Update(); etc.
}

Notes and troubleshooting: the IsNetworkDeployed check is false when running from Visual Studio or from the file system, so CurrentDeployment will not be available until the app is published and started via ClickOnce. The System.Deployment assembly and API are part of the .NET Framework ClickOnce model; projects targeting non‑Framework runtimes may not expose these types and will need an alternate update mechanism. If the task is only to read/write registry values (the project name suggests RegisteryCheck), ApplicationDeployment may not be required at all — a plain registry API will suffice.

Quick checklist: add a reference to System.Deployment, avoid new (use CurrentDeployment), guard with IsNetworkDeployed, and test against a published ClickOnce install rather than the debugger.

Recommended Answers

All 4 Replies

Member Avatar for Member #788144

Please could you tell me exactly what you are aiming to do?

Member Avatar for Member #788144

Also are you sure you havent got an error
here

ApplicationDeployment ab = new

doesnt it need to be

ApplicationDeployment ab = new ApplicationDeployment
Member Avatar for Member #804923

Try using the namespace System.Deployment.Application; instead of
using System.Deployment;

using System.Deployment.Application;
Member Avatar for Member #788144

I agree with saravind84. using System.Deployment.Application should work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.