Click here to Skip to main content
15,887,485 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.

Thanks

What I have tried:

I have tried researching on both Google and CodeProject for solution. Nothing I found addressed my problem.
Posted
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
 
Comments
Kevin Marois 9-Dec-22 13:36pm    
Griff,

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" />
    </GetAssemblyIdentity>

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

</Target>

<PropertyGroup>

    <PreBuildMacrosBuildEventDependsOn>
        $(PreBuildEventDependsOn);
        PreBuildMacros;
    </PreBuildMacrosBuildEventDependsOn>

    <PreBuildEvent>
        echo PRE-BUILD ASSEMBLY VERSION IS: @(PreBuildVersionNumber)
    </PreBuildEvent>

</PropertyGroup>



<Target Name="PostBuildMacros">

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

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

<PropertyGroup>

    <PostBuildEventDependsOn>
        $(PostBuildEventDependsOn);
        PostBuildMacros;
    </PostBuildEventDependsOn>

    <PostBuildEvent>
        echo POST-BUILD ASSEMBLY VERSION IS: @(PostBuildVersionNumber)
    </PostBuildEvent>

</PropertyGroup>


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
SETLOCAL ENABLEEXTENSIONS
SETLOCAL DISABLEDELAYEDEXPANSION

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.

Thanks
 
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