public static async Task Main(string[] args) { IWebHostBuilder builder; #if DEBUG var webPort = Electron.Experimental.FreeTcpPort(); await Electron.Experimental.StartElectronForDevelopment(webPort); builder = CreateWebHostBuilder(args); // check for the content folder if its exists in base director otherwise no need to include // It was used before because we are publishing the project which copies everything to bin folder and contentroot wwwroot was folder there. // now we have implemented the live reload if app is run using /watch then we need to use the default project path. if (Directory.Exists($"{AppDomain.CurrentDomain.BaseDirectory}\\wwwroot")) { builder.UseContentRoot(AppDomain.CurrentDomain.BaseDirectory); } builder.UseUrls("http://localhost:" + webPort); #else builder = CreateWebHostBuilder(args); Debugger.Launch(); Electron.ReadAuth(); builder.UseElectron(args); #endif await builder.Build().RunAsync(); }