cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ohjohnsen
Level 3

How to set Product Version automatically using AssemblyInfo

I'm using InstallShield 2015 Limited Edition in Visual Studio 2015.

I would like that when building SingleImage setup releases, the Product Version in General Information (see image) is set to the version given in AssemblyInfo.cs in the main project. Is this possible? If so, how?
Labels (1)
0 Kudos
(7) Replies
rguggisberg
Level 13

I suppose there a lots of ways to do it depending on your build environment.
How are you changing your Assembly Info file?
What I do in a TFS environment for InstallScript MSI projects and Suite projects is have TFS set the build number automatically in the build definition.
Pass that x.y.BuildNumber.0 as a parameter to a prebuild script which uses TF.EXE to do checkin/checkout programatically. Have that script change any files that need to be changed.
1. For CommonAssemblyInfo .cs & .vb files Checkout file/Change version/Checkin file
2. For each ISM file: Checkout file/Change version/Checkin file (Search for and change the line that contains the string "ProductVersion"). Probably different for Basic MSI project.
3. For .ISSUITE file: Checkout file/Change version/Checkin file ( Search for and change the line that contains the string "")

The version number is changed in the source so if you do manual builds it is still at that version (advantage or disadvantage... depending on your perspective).
It is not a simple matter but it can be done.
0 Kudos
ohjohnsen
Level 3

rguggisberg wrote:
I suppose there a lots of ways to do it depending on your build environment.
How are you changing your Assembly Info file?
What I do in a TFS environment for InstallScript MSI projects and Suite projects is have TFS set the build number automatically in the build definition.
Pass that x.y.BuildNumber.0 as a parameter to a prebuild script which uses TF.EXE to do checkin/checkout programatically. Have that script change any files that need to be changed.
1. For CommonAssemblyInfo .cs & .vb files Checkout file/Change version/Checkin file
2. For each ISM file: Checkout file/Change version/Checkin file (Search for and change the line that contains the string "ProductVersion"). Probably different for Basic MSI project.
3. For .ISSUITE file: Checkout file/Change version/Checkin file ( Search for and change the line that contains the string "")

The version number is changed in the source so if you do manual builds it is still at that version (advantage or disadvantage... depending on your perspective).
It is not a simple matter but it can be done.


I apologize for not getting back to you earlier.
My environment is very basic. I use the extension Automatic Versions to automatically increment version number attributes in AssemblyInfo.cs when building the main project.
And I set the same version number to AssemblyVersion and AssemblyFileVersion attributes.

I don't build the InstallShield setup project unless I want to build the installer. What I'd like is if it's possible to set a pre-build script or something on the setup project, that copies the version number from AssemblyInfo.cs and sets to the setup configuration prior to building the installer.
0 Kudos
rguggisberg
Level 13

What type of project(s)?
0 Kudos
ohjohnsen
Level 3

rguggisberg wrote:
What type of project(s)?


C# WPF desktop application, using .NET version 4.6.1.
0 Kudos
rguggisberg
Level 13

What type if InstallShield projects? InstallScriptMSI, Basic MSI, Suite?
0 Kudos
ohjohnsen
Level 3

rguggisberg wrote:
What type if InstallShield projects? InstallScriptMSI, Basic MSI, Suite?


To be honest, I'm not sure. I have just added a 'InstallShield Limited Edition Project' project to the Visual Studio 2015 solution. And when building a 'SingleImage' build, the output is a 'setup.exe' file. I'm adding a screen shot from the General Information view. Can you see from here what kind of InstallShield project? If not, how can I find out what kind of InstallShield project this is?

0 Kudos
rguggisberg
Level 13

Can't tell project type from that. Oh well... just do this.
1. Make a copy of your .ism file
2. Edit .ism file with Notepad.
3. Search for the line that contains the string "ProductVersion" (You will only find that for InstallScript MSI projects.)
4. If you find that string, change the version,save the file and build. You should see version change.
5. Now you know what to do. Create a prebuild script that gets the version number from your AssemblyInfo file and replace the string in the ism file.

If you have a Basic MSI project you won't find the string. I would need to do some research if that is the case. Send me a private email if you want help with that.
0 Kudos