locked
Change config settings for windows store app

    Question

  • Hi

    How can one change the connection strings or service references dynamically for a windows 8 app written in html5 and in xaml(two different apps)

    We cant go around rebuilding the app from a development point of view everytime the testers change the servers the web service resides on, whereby the web service is being requested from the apps.

    i did read up on the mimic of app.config for xaml windows 8 app, but how does this work for the html5 based app?

    Thank you

    Kind regards,

    Sasha 

    Friday, July 11, 2014 10:16 AM

Answers

All replies

  • an app should work just by installing it and without needing configuration by the user. So maybe just keep a global varialble where you set the url of the server and change it during development?

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Monday, July 14, 2014 5:54 AM
  • Thanks Dave, I don't want the user to update the config, but rather the deployment person, without that person having to rebuild the app in VS.

    This app needs to run on different servers, so having it changed every time by a developer, is not a viable solution.

    By config data I am referring to for example the 'connection string' of the service the app connects to.  

    Sasha

    Wednesday, July 23, 2014 10:09 AM
  • Ad Dave mentioned, Windows Store App should work without any configuration by user.

    I got an idea, but not sure if it fit your requirement. You can put the correct connection string or service reference at a static server and request the configuration settings when your app needs.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Wednesday, July 30, 2014 6:02 AM
    Moderator
  • Thanks Jamles

    would it go against MS store app best practices, if I were to use a file, that gets installed on the machine, and then use that file to get the url for the web service for example?

    So an app can be built an deployed, but if the web server it currently references has changed, there would be no need to rebuild the app, just change the file on the machine (file access would have to be tightened for that file though)

    Kind regards,

    Sasha

    Tuesday, September 09, 2014 10:16 AM
  • Store deployed apps cannot depend on any external files like that. You could get away with it for a side-loaded app.

    A more general option would be to expose the server in the app's settings pane and save it in local (or roaming) settings. This setting could point to a file which is externally updated.


    Friday, September 12, 2014 8:28 AM
    Owner
  • thanks Rob, the apps are going to be side-loaded.
    Tuesday, September 16, 2014 11:43 AM
  • If you're side-loading the apps then you can add your own external requirements beyond what would pass certification and be allowed in the store.

    --Rob

    Tuesday, September 16, 2014 7:20 PM
    Owner
  • thanks Rob

    the person that will deploy these apps doesnt want to rebuild the app everytime the webservice url is changed, from development server to pre-prod server to prod server, I was telling him that we would have to put the "config settings" file in the application local folder, but he was asking why cant we put it in a generic location like c program files, I was explaining to him, that from what I read the application doesnt have access to those folders, only the folders that you set it to have access to.

    So my question is, can we grant an app access to read a file from the c:\program files folder?

    Kind regards,

    Sasha

    Wednesday, September 17, 2014 7:56 AM
  • A side-loaded app can use a brokered Windows Runtime Component to get full desktop access. See http://blogs.msdn.com/b/wsdevsol/archive/2014/04/14/cheat-sheet-for-using-brokered-windows-runtime-components-for-side-loaded-windows-store-apps.aspx

    You may be able to muddle the security on a directory to let the app read it, but I don't have the details handy. You can examine the security on the app's local storage with icacls to see what is needed.

    • Marked as answer by Sasha_za Thursday, September 18, 2014 9:28 AM
    Wednesday, September 17, 2014 2:38 PM
    Owner
  • Thanks Rob

    Much appreciated.

    Will fiddle around with it, and hopefully can get a good solution.

    Sasha

    Thursday, September 18, 2014 9:27 AM
  • I tried fiddling with the icacls, but that didnt have much impact, so i decided to just add the path of the config file to the documents library, so far it seems to be working fine, i am able to read the config file.

    Thursday, September 25, 2014 9:52 AM