Search code examples
c#winformswindows-installersetup-projectregedit

How to add a value in regedit key while creating Visual studio Setup Project (.msi)


I know the question is a bit confusing so allow me to elaborate everything from the start to the end.

  1. I am creating a setup project in visual studio.
  2. I have created a Regidit key and with a string value

{"Dys":[],"Frequency":"15","Hour":11,"Minutes":2,"ScheduledDate":"/Date(1440095400000+0530)/","ScheduledOn":null,"scheduleType":4}

enter image description here 3. while building the project I am getting an error (given below)

Error 1 Invalid characters '{"Dys":[],"Frequency":"15","Hour":11,"Minutes":2,"ScheduledDate":"/Date(1440095400000+0530)/","ScheduledOn":null,"scheduleType":4}' in value for registry value 'ScheduleScan', located in 'HKLM\Software\TechHeal\TechHeal' C:\Users\Paxcel\Desktop\svn\Code\TechHeal\TechHeal 15 June - New Design\Setup Projects (MSI)\Techheal\Techheal\Techheal.vdproj Techheal

However, If I am directly creating the (regedit)string key from the Regedit viewer of windows then its creating the key with the same value without any issue. enter image description here


Solution

  • Normally when you create registry settings through windows installer, Non-ASCII characters cannot be evaluated by the windows installer and you might get similar error message.

    But I don't see any non-ASCII in the value that you have used.

    Try removing the square brackets. If that works you can use ()

    {"Dys":[],"Frequency":"15","Hour":11,"Minutes":2,"ScheduledDate":"/Date(1440095400000+0530)/","ScheduledOn":null,"scheduleType":4}