Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Identifying the Publish Version of a ClickOnce app at Runtime

254 views
Skip to first unread message

michael

unread,
Jun 20, 2008, 5:30:18 PM6/20/08
to
Not really sure where to post this but here goes:

I would like to be able to put a Publish Version in an AboutBox in my VS
2008 WPF application. I am following this example in the VS2008 help files:

ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/fxref_system.deployment/html/a848f1ad-bea0-1762-ff71-542adc0cdcc9.htm

I am having difficulty adding the following to my source code:

Imports System.Deployment.Application

I get the following error:

Namespace or type specified in the Imports 'System.Deployment.Application'
doesn't contain any public member or cannot be found. Make sure the namespace
or the type is defined and contains at least one public member. Make sure the
imported element name doesn't use any aliases.

I'm not sure why I can't list this import. I'm following the example code
exactly. Any ideas?
--
Michael

Marc Gravell

unread,
Jun 23, 2008, 3:03:34 AM6/23/08
to
You need to add a reference to System.Deployment.dll

Marc

RobinS

unread,
Jun 25, 2008, 1:42:56 AM6/25/08
to
Here you go. You have to get the deployment version. Note that if you are
running it from VS, this pulls the assembly version, because you're not
running the deployed version. If you are having build problems, make sure
you have a reference to System.Deployment in references for your project.

public string version
{
get
{
System.Reflection.Assembly _assemblyInfo =
System.Reflection.Assembly.GetExecutingAssembly();

string ourVersion = string.Empty;

//if running the deployed application, you can get the version
// from the ApplicationDeployment information. If you try
// to access this when you are running in Visual Studio, it will
not work.
if
(System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
{
ourVersion =
ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();
}
else
{
if (_assemblyInfo != null)
{
ourVersion = _assemblyInfo.GetName().Version.ToString();
}
}
return ourVersion;
}
}

RobinS.
GoldMail.com
===============
"michael" <mic...@discussions.microsoft.com> wrote in message
news:D099D854-4FC7-474D...@microsoft.com...

0 new messages