web reference test vs prod addresses

shabobooshaboboo Member
edited November 6 in General

Hello! I'm writting an application for android and iOS that has several web service references.

Currently we are testing changes to the webservices and need to easily switch the references in the app between the test service and the prod service.
Idealy I would like to be able to put the address in a config file somewhere so I can change it easily. I'm just not sure how to set this up.

Does anyone know how I might go about doing this? or any other suggestion to achieve something similar?

thanks.

Posts

  • JohnHardmanJohnHardman GBUniversity mod

    @shaboboo said:
    Hello! I'm writting an application for android and iOS that has several web service references.

    Currently we are testing changes to the webservices and need to easily switch the references in the app between the test service and the prod service.
    Idealy I would like to be able to put the address in a config file somewhere so I can change it easily. I'm just not sure how to set this up.

    Does anyone know how I might go about doing this? or any other suggestion to achieve something similar?

    thanks.

    Depending on how your builds are done, you could either add a new build configuration in Visual Studio's Configuration Manager with the different build configurations, or you could have your build system specify different compilation symbols for test and prod. Using different build configurations, you could either have the different configurations define different compilations symbols, or you could have them build different projects. Whichever of these options you go for, these give you mechanisms for accessing different code/data for test and prod.

  • shabobooshaboboo Member

    Thanks @JohnHardman ! You've led me in the right direction.
    I've set up a new build configuration, and used #if directives to set the webservice's URL property right after creating an instance of it in the code.
    Works like a charm!

  • JohnHardmanJohnHardman GBUniversity mod

    @shaboboo said:
    Thanks @JohnHardman ! You've led me in the right direction.
    I've set up a new build configuration, and used #if directives to set the webservice's URL property right after creating an instance of it in the code.
    Works like a charm!

    Great - glad it works. Don't forget to Like and/or mark as Accepted Answer the post above :-)

Sign In or Register to comment.