Neil, I just had this same issue myself. I wanted to move some settings from an INI file to the registry and I was reading my values value back using registry search but it always comes back as '#1' and you can't write that back as an integer. It took me a while as I couldnt believe that it couldnt be done as to me that is an obvious feature an MSI should be able to deal with......
Anyway, to cut a long story short after several hours of exasperated attempts I stumbled upon something buried in some documentation (I forget exactly where I read it) that said something like when you write a value, the MSI can work out what type of value is being written by the prefix. I didnt take much notice of it at first. However, what I eventually realized is that it means is you have to write a value with a default type and let the MSI work out from the values formatting what type it really is. What you therefore have to do is write it back as a string and let it work out, from the # at the beginning, it's a number!!! So far, its proved perfect up to now for me! Here's my WXS taken from my MSI (with the names changes to protect the innocent). At the start of my MSI, I read the registry using this <Property Id="PROPERTYNAME" Value="#-1"> <RegistrySearch Id="regSearchName" Root="HKLM" Key="<Approppriate Key>" Name="<ParameterName>" Type="raw" /> </Property> The Value section sets the default in case the registrySearch fails. Note the # prefix. Without this, the value is not treated as an integer. Later, I do this to write the value back. <Component Id="<InsertName>" Guid="<Insert GUID>"> <RegistryValue Id="SomeName" Action="write" Root="HKLM" Key="<Same AppropriateKey as above>" Name="<same ParamterName as above" Value="[PROPERTYNAME]" Type="string" /> </Component> I believe it or not, the write actually writes a DWORD even though you ask it to write a string!!! Hope this helps Chris Lord Attero Tech, LLC -----Original Message----- From: Neil Sleightholm [mailto:n...@x2systems.com] Sent: Sunday, October 28, 2012 4:39 AM To: General toolset. (wix-users@lists.sourceforge.net) Subject: [WiX-users] Setting DWORD registry keys In my installation I need to set a dword registry to a default value when the install is first run and remove the key on uninstall but not change it on an upgrade. I am struggling to find a way to do reliably and wondered if anyone had any suggestions. Here is what I have tried: 1. Read the existing value with <RegistrySearch> and rewrite it on upgrade, this fails because DWORDs come back prefixed with a hash (#) and <RegistryValue> causes this to be written as a string. 2. Read the existing value with <RegistrySearch> and Condition the <RegistryValue> so it is only written when the value is not set. The problem with this is that on upgrade the key is removed. I can solve this by writing a CA to read the values but I am sure there must be a standard way of doing this that is eluding me. Neil Neil Sleightholm X2 Systems Limited n...@x2systems.com<mailto:n...@x2systems.com> ------------------------------------------------------------------------ ------ WINDOWS 8 is here. Millions of people. Your app in 30 days. Visit The Windows 8 Center at Sourceforge for all your go to resources. http://windows8center.sourceforge.net/ join-generation-app-and-make-money-coding-fast/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ The Windows 8 Center - In partnership with Sourceforge Your idea - your app - 30 days. Get started! http://windows8center.sourceforge.net/ what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users