title: Azure App service can't start because it can't find swagger documentation xml using ASP.NET Core
body: <p><strong>Update 2:</strong> The file does not get published. That is what is wrong. However, I can't figure out why one of my computers can publish it the right way and the other doesn't after the Visual studio upgrade.</p>
  
  <p><strong>Update</strong>: Running the same solution on two different computers where the APIProject.xml file get's correctly published from one computer but not the other there are now only one difference left. The computer from which the publishing works runs the not updated version of Visual studio 2017 Enterprise. 15.5.2 does not work and 15.4.2 works. </p>
  
  <p>I'm getting this error: </p>
  
  <blockquote>
    <p>FileNotFoundException: Could not find file
    'D:\home\site\wwwroot\APIProject.xml'.</p>
  </blockquote>
  
  <p>The file is placed in bin\Debug\netcoreapp2.0 
  It works locally but when published to Azure App service it crashes. </p>
  
  <p>I'm publishing to the staging slot I created and haven't tried production yet. Publishing replaces all files at destination. </p>
  
  <p>Here is my setup of Swagger but it used to work :)</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
      {
          services.AddMvc();
  
          // Register the Swagger generator, defining one or more Swagger documents
          services.AddSwaggerGen(c =&gt;
          {
              c.SwaggerDoc("v1", new Info
              {
                  Version = "v1",
                  Title = "Ecommerce/Product API",
                  Description = "Handles API based shopping functionality",
                  TermsOfService = "Terms of service should be contracted with inidividually",
                  Contact = new Contact { Name = "Magnus", Email = "magnus@secret", Url = "" },
                  License = new License { Name = "Use under permission from our Group", Url = "http://aboutno" }
              });
  
              // Set the comments path for the Swagger JSON and UI.
              var basePath = PlatformServices.Default.Application.ApplicationBasePath;
              var xmlPath = Path.Combine(basePath, "APIProject.xml");
              c.IncludeXmlComments(xmlPath);
          });   
      }
  </code></pre>
  
  <p>What has changed is I added the "UseSetting"-row in Program.cs to get errors of why it doesn't start. Before adding that row I did't get developer error, only got end user error page.</p>
  
  <pre><code>public static IWebHost BuildWebHost(string[] args) =&gt;
          WebHost.CreateDefaultBuilder(args)
              .UseApplicationInsights()
              .UseSetting(WebHostDefaults.DetailedErrorsKey, "true")
              .UseStartup&lt;Startup&gt;()
              .Build();
  </code></pre>
  
  <p>I'm trying to publish with Debug mode. Also tried with Release as of one answer below but no difference.</p>
  
  <p>I checked out the code in another computer and publishing from that computer works so the problem just got more weird to me!</p>