7

I want to modify values in an existing json file.

When I run my installer I type server name which points to my API. After I typed server name I want to add that value in app settings json file.

enter image description here

enter image description here

enter image description here

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Alex
  • 1,013
  • 1
  • 13
  • 27
  • Do this in a Custom Action – Morten Frederiksen Sep 21 '17 at 12:41
  • Can you be more specific? – Alex Sep 21 '17 at 13:01
  • That would take hours and fall in the do it for you category. I would seriously consider rewriting your code to store your configuration data in XML and then transform it to JSON if needed on load. – Christopher Painter Sep 21 '17 at 16:40
  • 1
    The WPF tag suggests you are installing an application (that is, a program with a UI and run by a user). So, as an alternative, implement this functionality as a first-run or re-configure operation in the application. Of course, this wouldn't work well if only an administrator would have the knowledge or permission to set the configuration. – Tom Blodget Sep 23 '17 at 23:13
  • @ChristopherPainter I disagree. Modern frameworks are moving to JSON files for configuration (.net core for example). Seems like WIX is the installer MS is sticking with so it really needs JSON and XML support. The correct answer is unfortunately custom actions. – spyder1329 Jun 13 '19 at 23:28
  • FWIW is a custom action. It's provided by a WiX extension because MSI doesn't do it natively. It's just a custom action provided by WiX without having to do it yourself. Writing custom actions that are declarative, transactional and bullet proof are hard and take a lot of testing. Maybe you could submit a WIP to the wix-devs mailing list offering to write it. – Christopher Painter Jun 13 '19 at 23:39

1 Answers1

2

http://dotnetbyexample.blogspot.ro/2010/11/wix-configurable-search-replace-custom.html

You need to create a wix project (Custom Action Class Library) create logics, after that you need to use dll in Product.wxs (Installer project) like in example.

PS: if you want to change one property from file, you should have something like this:

enter image description here

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Alex
  • 1,013
  • 1
  • 13
  • 27
  • help here https://stackoverflow.com/questions/57294132/how-to-update-appsettings-json-from-wix-custom-actions-with-the-values-passed-as – kudlatiger Aug 01 '19 at 10:58