Share via

Deploying Xamarin apps with different end points.

David 356 Reputation points
2021-06-03T10:21:01.74+00:00

Hi

Can someone guide me on this?

I have got a Xamarin form with iOS and Android and I would like to know what is the best way for me to set it up so I can set up different endpoints for use with API calls depending on if it is release or debug when archiving for publishing.

I have got the code in Azure. For instance, I can use environment variables on app settings on Azure and get it pointing to any endpoint. What is the best approach for a xamarin app?

Thanks

Developer technologies | .NET | Xamarin
0 comments No comments

1 answer

Sort by: Most helpful
  1. JarvanZhang 23,971 Reputation points
    2021-06-04T02:57:00.58+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    so I can set up different endpoints for use with API calls depending on if it is release or debug when archiving for publishing.

    Do you mean execute different code in debug and release mode? If so, try using the conditional compilation of C# preprocessor directives.

       private void Button_Clicked(object sender, EventArgs e)  
       {  
           #if DEBUG  
                   //perform the work  
           #else  
                   //perform the work  
           #endif  
       }  
    

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.