Alex, The MSI version is different from a file version and you have to extract it from the MSI database. I did it using a python script and msilib but I was doing it outside of MSBuild. You could also do it with C#, here's a page with an example: http://stackoverflow.com/questions/10233400/how-to-get-msi-version
I would think you could make a custom task to do what you want. I'm not aware of anything already existing. -----Original Message----- From: Alex Misca [mailto:alex.mi...@softvision.ro] Sent: Wednesday, February 19, 2014 4:29 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Getting WiX Product version in MSBuild Hi, I've managed to create add WiX project to my C# solution which build the msi package. I've set the product version to be automatically obtained from the app's executable file version. But now I want to be able to get that version inside the msbuild script (wixproj file). What I'm trying to achieve is in the "AfterBuild" target, instruct msbuild to copy the msi package in a different folder depending on the product version. I could do this for the application that I'm packing in msi format using this custom task in msbuild: < UsingTask TaskName = " GetVersion " TaskFactory = " CodeTaskFactory " AssemblyFile = " $(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll " > < ParameterGroup > < ExeFile Required = " true " ParameterType = " System.String " /> < ExeVersion ParameterType = " System.String " Output = " true " /> </ ParameterGroup > < Task > < Code Type = " Fragment " Language = " cs " > <![CDATA[ ExeVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo( ExeFile ).FileVersion; ]]> </ Code > </ Task > </ UsingTask > And call the task with: < GetVersion ExeFile = " $(TargetPath) " > < Output PropertyName = " CurrentVersion " TaskParameter = " ExeVersion " /> </ GetVersion > But if I place this exact code inside the wixproj i get an empty value. I think it's because the msi project file doesn't have a FileVersion. So how can I pass the product version from WiX in msbuild? Or is there another way to do this? Thanks, Alex Misca | .NET Engineer SOFTVISION | 57 Republicii Street, 400489 Cluj-Napoca, Romania Email: alex.mi...@softvision.ro | Web: www.softvision.com The content of this communication is classified as SOFTVISION Confidential and Proprietary Information. ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users