Click here to Skip to main content
15,920,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have been tasked with updating an InstallShield Project file's "ProductVersion" tag with the new Assembly Version info after Visual Studio finishing building.

I could write a quick C# console app that does it, but I'm wondering if anyone else has a better idea.


What I have tried:

I have tried researching on both Google and CodeProject for solution. Nothing I found addressed my problem.
Updated 9-Dec-22 6:19am

I'd write the app: then set it as a post build step (release version only) with the assembly version passed as a command line parameter.

This may help: Determine assembly version during a post-build event[^]
Share this answer
Kevin Marois 9-Dec-22 13:36pm    

I can't seem to get the Pre-Build version number. Do you know of a way to get this?
Griff, this is what I have so far:
<Target Name="PreBuildMacros">

    <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
        <Output TaskParameter="Assemblies" ItemName="Targets" />

        <PreBuildVersionNumber Include="@(Targets->'%(Version)')"/>




        echo PRE-BUILD ASSEMBLY VERSION IS: @(PreBuildVersionNumber)


<Target Name="PostBuildMacros">

    <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
        <Output TaskParameter="Assemblies" ItemName="Targets" />

        <PostBuildVersionNumber Include="@(Targets->'%(Version)')"/>



        echo POST-BUILD ASSEMBLY VERSION IS: @(PostBuildVersionNumber)


I'm thinking that I could capture the both pre*build and post-build version numbers and pass them to this batch file:

@echo off

if "%~1"=="" findstr "^::" "%~f0"&GOTO:EOF
for /f "tokens=1,* delims=]" %%A in ('"type %3|find /n /v """') do (
    set "line=%%B"
    if defined line (
        call set "line=echo.%%line:%~1=%~2%%"
        for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X
    ) ELSE echo.

Except I can't seem to capture the pre-build version #. Working on it. I'll add the release version check when this is done.

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900