I would like to extract the version number from this code:
<?xml version="1.0" encoding="UTF-8"?>
<Include>
<?define ProductVersion = "1.0.0.0" ?>
</Include>
I want the output to be: 1.0.0.0
, is it possible to do this?
If you are using Visual Studio to create the WIX based installer then you can define your ProductVersion
variable in the .wixproj
file.
<Target Name="BeforeBuild">
<PropertyGroup>
<DefineConstants>ProductVersion=1.0</DefineConstants>
...
</PropertyGroup>
</Target>
This would be accessible from .wxs file by $(var.ProductVersion)
. Now you can use XPath to read the value of DefineConstants
from your .wixproj file. This will get you ProductVersion = "1.0.0.0"