0

I am building an Azure Devops Release pipeline and I have a WIX config file in my source code with the following structure

<?xml version="1.0" encoding="utf-8"?>
<Include>
  <?define Key ="MyValue"?>
</Include>

I would like to replace "MyValue" with "MyNewValue" using the Replace Tokens package (link here)

Following the answer given here.

I have <Include> as my token prefix and </Include> as my token suffix. I've added the following pipeline variable: enter image description here When I build my pipeline it finds the file correctly, but doesn't find any variables to replace, am I missing something to link the variables step to the pipeline variables?

alternatively I was thinking the '<?' tags could be throwing it off or perhaps it's just not compatible with the WIX xml files?

h_dummy
  • 3
  • 2

1 Answers1

0

Why not just pass the preprocessor variable via the .wixproj or command-line (whichever way you are building). That way you avoid the include file completely and have a much simpler solution.

I cover this technique in Episode 12 of the Deployment Dojo - All the Ways to Change. Variables and Variables. Directories and Properties:

<Project Sdk="WixToolset.Sdk/4.0.0">
  <PropertyGroup>
   <DefineConstants>Key=MyValue</DefineConstants>
  </PropertyGroup>
</Project>

Then you can easily override the value with msbuild -p:Key=MyNewValue.

Rob Mensching
  • 33,834
  • 5
  • 90
  • 130
  • Thanks for this that looks really cool, do you know by any chance if the inner '' tags (instead of '<') might throw things off here? Will check out the episode though thanks! – h_dummy Jun 05 '23 at 09:26
  • The `` indicates a preprocessing instruction. In the WiX Toolset, that is evaluated before the build (by the preprocessor). I don't really follow your question after that. – Rob Mensching Jun 05 '23 at 14:17