Hey again Blaine, > Si - I wasn't as clear as I meant to be before. > Because our automated packager builds at least 2 MSI's a day per product > and has built up to 6 versions in a day when we are close to deadline I > really don't want to open and update Wix by hand to change the > variables.
Ok, in our process the PreviousProductVersion is the previously released version, not the previously built version. Of course everyones product lifecycle and process is going to be different, so that makes sense. > Today, I use a VB script to open the last msi, read it's Product Version > and then increment it and feed the New and Previous Version numbers into > Candle via the command line. > > I'm wondering if there is a better, or safer, long term approach to > these steps than reading the last MSI, such as storing the old values in > a DB or log file. What are others doing? It's may not be what you want, but I've now got the wixproj BeforeBuild target working to update wix ProductVersion variable from our products common AssemblyInfo.cs file. I couldn't get the RegexReplace task working, but found a workaround. Here's the code: <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" /> <Target Name="BeforeBuild"> <ReadLinesFromFile File="..\Properties\AssemblyInfo.cs"> <Output TaskParameter="Lines" ItemName="ProductAssemblyInfo"/> </ReadLinesFromFile> <RegexMatch Input="@(ProductAssemblyInfo)" Expression="AssemblyVersion"> <Output ItemName="ProductAssemblyVersion" TaskParameter="Output" /> </RegexMatch> <FileUpdate Files="Config.wxi" Regex='define ProductVersion = "[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?"' ReplacementText='define ProductVersion = "@(ProductAssemblyVersion)"' /> <FileUpdate Files="Config.wxi" Regex='\[assembly: AssemblyVersion\(\"(?<version>[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?)\"\)\]' ReplacementText="${version}" /> </Target> <Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'"> <CreateItem Include="$(OutputPath)$(OutputName).msi"> <Output ItemName="ReleaseFiles" TaskParameter="Include" /> </CreateItem> <Copy SourceFiles="@(ReleaseFiles)" DestinationFolder="$(OutputPath)..\..\..\..\..\..\..\Deploy\Setup" /> </Target> The regex could be optimized, but it works. Blaine, perhaps one option for you might be to rename the last msi built before the build takes place, capture the version of this, and then do the same for your PreviousProductVersion variable as per ProductVersion above? -- It's a wild world that we live in, you step to the vibe like a new found religion, take your position, compile your vision, futurism, algorithm has risen up! pfm - the western ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users