显示ClickOnce部署版本的WPF应用程序

显示ClickOnce部署版本的WPF应用程序

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

问题描述

我现在部署WPF C#项目,并希望把在 ClickOnce版本(而不是assymbly或产品版本)在屏幕上的标题。
我用来做什么用以下方式赢窗体应用程序。但似乎不是在WPF应用程序的方式。我搜索在谷歌BU没有发现任何东西。请帮助。

 如果(System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment广告= ApplicationDeployment.CurrentDeployment;
lblVer.Text =V+ ad.CurrentVersion.ToString();
}
,否则
lblVer.Text =V+ Application.ProductVersion.ToString();


解决方案

OK,
我发现这个问题。
我不得不添加引用 System.Deployment
这就是为什么我不能使用它。此DLL是对的WinForms也。


I'm deploying now a WPF c# project and want to put the clickonce version (rather than the assymbly or product version) on the screen title.I used to do it in Win form application with the following way. But it seems that it is not the way in WPF applications. I search on Google bu didn't find anything. Please help.

    if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
    {
        ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
        lblVer.Text = "V" + ad.CurrentVersion.ToString();
    }
    else
        lblVer.Text = "V" + Application.ProductVersion.ToString();
解决方案

OK,I found the problem.I had to add reference to System.DeploymentThat is why I couldn't use it. This dll is for winforms also.

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

07-27 23:49