在WPF应用程序中获取ClickOnce版本 [英] Get ClickOnce Version in WPF Application

查看:184
本文介绍了在WPF应用程序中获取ClickOnce版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我不使用汇编版本,所以我想知道我可以在WPF c#程序中获得ClickOnce版本。 />


当我使用以下代码时:

 如果(ApplicationDeployment.IsNetworkDeployed)
{
Version version = ApplicationDeployment.CurrentDeployment.CurrentVersion;
}



我得到以下错误:



当前上下文中不存在名称'ApplicationDeployment'



我已经尝试实现System.Deplayoment,但它没有用:/



请帮忙,谢谢。

解决方案

阅读本文:http://stackoverflow.com/questions/14485914/cannot-find-applicationdeployment-in-system-deployment [ ^ ]


< blockquote>好的,我知道为什么它不起作用。



我认为使用WPF而不是WinForms时c#是不同的,但它没有。



我的代码是正确的,但我忘了添加 System.Deployment.dll 作为资源。



感谢Mehdi Gholam提供有用的链接! :)

Hi,

I don't use Assembly Version, so I'd like to know I can get the ClickOnce Version in an WPF c# Program.

When I use the Following Code:

if (ApplicationDeployment.IsNetworkDeployed)
{
    Version version = ApplicationDeployment.CurrentDeployment.CurrentVersion;
}


I get get the following Error:

The name 'ApplicationDeployment' does not exist in the current context


I already tried to implement System.Deplayoment, but it didn't worked :/

Please Help, thanks.

解决方案

Read this : http://stackoverflow.com/questions/14485914/cannot-find-applicationdeployment-in-system-deployment[^]


Okay, i know why it didn't worked.

I thought c# is diffrent when using WPF instead of WinForms, bhut it didn't.

my Code was correct, but i forgot to add the System.Deployment.dll as Resource.

Thanks to Mehdi Gholam for the useful Link! :)


这篇关于在WPF应用程序中获取ClickOnce版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆