wpf 在 System.Deployment 中找不到 ApplicationDeployment
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14485914/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot Find ApplicationDeployment in System.Deployment
提问by Jesse
I have a built program and I am trying to change out the default clickOnce update checker with a hard programmed one. I have added the using System.Deployment;but it does not contain the assembly information I need to call. What am I missing here? I have searched MSDN but it keeps saying this is the correct namespace to call.
我有一个内置程序,我正在尝试用硬编程的程序更改默认的 clickOnce 更新检查器。我已经添加了using System.Deployment;但它不包含我需要调用的程序集信息。我在这里缺少什么?我已经搜索过 MSDN,但它一直说这是要调用的正确命名空间。
The error shows as:
The name ApplicationDeployment does not exist in the current context
错误显示为:
The name ApplicationDeployment does not exist in the current context
Code from 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();
}
}
回答by ryadavilli
ApplicationDeploymentclass is present in System.Deployment.Applicationnamespace and not System.Deployment. Change your using accordingly or try with the full name System.Deployment.Application.ApplicationDeployment
ApplicationDeploymentclass 存在于System.Deployment.Application命名空间中,而不存在于System.Deployment. 相应地更改您的使用或尝试使用全名System.Deployment.Application.ApplicationDeployment
回答by Federico Berasategui
You need to add using System.Deployment.Application;as well.
您还需要添加using System.Deployment.Application;。

