title: How to define build configurations for different API base URLs in UWP Project VS2015?
body: <p>I have started building a UWP application. In it, I am going to have different API deployments which changes the BaseURL like following:</p>
  
  <pre><code>//DEV Api
  public const string BaseURL = "http://mydevapi.com/devApi";
  //Test Api
  public const string BaseURL = "http://mytestapi.com/testApi";
  //UAT Api
  public const string BaseURL = "http://myuatapi.com/uatApi";
  //Live Api
  public const string BaseURL = "http://myliveapi.com/LiveApi";
  </code></pre>
  
  <p>So basically I want a way to change the baseURL on dynamically based on what kind of build I am making i.e. Dev, Test or Live. </p>
  
  <p>I have previous experience of iOS and in XCode we create different <a href="https://developer.apple.com/library/content/featuredarticles/XcodeConcepts/Concept-Schemes.html" rel="nofollow noreferrer">schemes</a> for this purpose. </p>
  
  <p>I have seen the documentation and I think the best bet I have in c# and Visual studio is <a href="https://msdn.microsoft.com/en-us/library/kwybya3w.aspx" rel="nofollow noreferrer">Build configuration</a> as it is described as:</p>
  
  <blockquote>
    <p>You can create several build configurations for a solution. For
    example, you can configure a debug build that your testers can use to
    find and fix problems, and you can configure different kinds of builds
    that you can distribute to different customers.</p>
  </blockquote>
  
  <p>I have created a new build configuration named "AppName.Dev" but how can I use it to change the baseURL constant to Dev url?</p>
  
  <p>This might come off as a basic question and shows my inexperience with c# and Visual studio but I can't figure out how do I make it materialize even after reading the documentation on it. Help a fella out?</p>
  
  <p><strong>EDIT:</strong> After reading <a href="http://haacked.com/archive/2007/09/16/conditional-compilation-constants-and-asp.net.aspx/" rel="nofollow noreferrer">this article</a>, I have created four different configurations and defined conditional compilation symbols like following:</p>
  
  <p><a href="https://i.stack.imgur.com/wuexo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wuexo.png" alt="enter image description here"></a></p>
  
  <p>I have now used the defined compilation symbols in my constants file like this:</p>
  
  <pre><code>public const string BaseURL = "";
  #if DEV
  public const string BaseURL = "http://mydevapi.com/devApi";
  #elif TEST
  public const string BaseURL = "http://mytestapi.com/testApi"
  #elif UAT
  public const string BaseURL = "http://myuatapi.com/uatApi"
  #elif LIVE
  public const string BaseURL = "http://myliveapi.com/LiveApi";
  #endif
  </code></pre>
  
  <p>The symbols however don't seem to be working as it returns empty string for baseURL even though I am running it in DEV configuration. Will update when I sort it out. </p>
  
  <p><strong>EDIT 2:</strong> Figured it out. I had two projects in my solution and I was defining configs and their symbols in one project while using them in the other. Posting an answer.</p>