5

I have set up a Deployment Project for my application. The problem is that I want to show application version (eg. MyApplication 1.2.3.1) during installation so the user can see the version before installing.

The only way I can think of is to modify the WelcomeText in Welcome dialog. Is there an easier or more elegant way to achieve this?

SwDevMan81
  • 48,814
  • 22
  • 151
  • 184
Zefo
  • 217
  • 1
  • 3
  • 7

2 Answers2

6

You should be able to use the Windows Installer ProductVersion property for this. If you change the Welcome dialog's WelcomeText property to:

The installer will guide you through the steps required to install [ProductName] [ProductVersion] on your computer.

Then you can change the Deployment Project's Version property and have the value automatically displayed. Any string-based property can do this; just use the [] syntax to have the value inserted.

For other properties that are provided out of the box, see the Windows Installer Property Reference

Andy Hopper
  • 3,618
  • 1
  • 20
  • 26
  • Where is exactly is the `[ProductVersion]` number set? I have my application `AssemblyVersion` and `AssemblyFileVersion` properties set and when I build my app and check the details tab it tells me the version is 1.1.0, however, when I run my installer it shows 1.0.0....any ideas? – James Jan 04 '11 at 22:43
  • It's ok I found it, didn't realise the installer itself is where I set the version I thought it picked it up from the application. – James Jan 04 '11 at 22:50
2

You can get the version number that is set in the executing AssemblyInfo.cs using this code

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()

Similarly if you want to get the version number for a specific assembly you can use

System.Reflection.Assembly.GetAssembly([type in my assembly]).GetName().Version.ToString()

You could then change the welcome text automatically at runtime.

James Gaunt
  • 14,631
  • 2
  • 39
  • 57
  • Thanks for the replay. However in Deployment Proejct - User Interface I have something like this http://www.codeproject.com/KB/install/SetupAndDeployment/userInterfaceWindow1.JPG So I don't see the possibility to custom modify the dialog boxes or enter any C# code. – Zefo Jul 12 '10 at 06:11