getting the application publish version

A

Aussie Rules

Hi,

I use the publish feature within Vs.net 2008, and have it set to increment
on each build/publish

I want to be able to display this as my application version number, but can
not see how to access the information.

application.productversion doesn't seem to access/use the publish version.

Thanks
 
K

kimiraikkonen

Hi,

I use the publish feature within Vs.net 2008, and have it set to increment
on each build/publish

I want to be able to display this as my application version number, but can
not see how to access the information.

application.productversion doesn't seem to access/use the publish version.

Thanks

Isn't there "publish" in solution explorer -> your app -> right click
then properties -> "publish"?
 
R

RobinS

Are you using ClickOnce deployment? Is that what you mean when you say
you are using "the publish feature" ?

If so, you can only see the deployment version when you are running the
deployed version. Here's how to get it. Sorry; this is in C#. I really
miss VB...

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();
}
}

This is probably the same thing in VB (no promises, it's been a while):

'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.
Dim ourVersion as String
If System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed
ourVersion =
ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();
Else
If _assemblyInfo IsNot Nothing
ourVersion = _assemblyInfo.GetName().Version.ToString();
End If
End If

Good luck; hope this helps.
RobinS.
GoldMail, Inc.
--------------------------------------
 
K

kimiraikkonen

yep,

i want to get that value in the runtime application, not the vs ide

What about this?

' ' ' ' ' ' '
My.Application.Info.Version.ToString
' ' ' ' ' ' '
 
K

kimiraikkonen

' ' ' ' ' ' '
My.Application.Info.Version.ToString
' ' ' ' ' ' '

Update: This method only gives assembly version.

Also, i don't know how to see publish version (VB.NET 2005, without
SP), but publish version is not synronized with assembly version as
well. Right/why?
 
R

RobinS

See my other post. I'm assuming the OP is using ClickOnce, and you have to
pull the DeploymentVersion. And you can only see it if you are running the
deployed version, not if you are running in VS. It's kind of a pain, but not
a huge problem for us.

If you want them to be the same, you have to update the assembly version
before doing the deployment.

RobinS.
GoldMail, Inc.
---------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top