Update 2: 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.
Update: 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.
I'm getting this error:
FileNotFoundException: Could not find file 'D:\home\site\wwwroot\APIProject.xml'.
The file is placed in bin\Debug\netcoreapp2.0 It works locally but when published to Azure App service it crashes.
I'm publishing to the staging slot I created and haven't tried production yet. Publishing replaces all files at destination.
Here is my setup of Swagger but it used to work :)
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
// Register the Swagger generator, defining one or more Swagger documents
services.AddSwaggerGen(c =>
{
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);
});
}
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.
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseApplicationInsights()
.UseSetting(WebHostDefaults.DetailedErrorsKey, "true")
.UseStartup<Startup>()
.Build();
I'm trying to publish with Debug mode. Also tried with Release as of one answer below but no difference.
I checked out the code in another computer and publishing from that computer works so the problem just got more weird to me!