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

Reply via email to