implement electron build with electron-packager into build.cmd and change the current root path from WebApp

This commit is contained in:
Gregor Biswanger
2017-10-05 03:47:09 +02:00
parent 12472746bc
commit 68bc483f52
11 changed files with 1510 additions and 49 deletions

View File

@@ -1,6 +1,6 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using System.IO;
using System;
namespace ElectronNET.WebApp
{
@@ -11,9 +11,11 @@ namespace ElectronNET.WebApp
BuildWebHost(args).Run();
}
// WICHTIG! UseContentRoot auf Assembly Ordner Essentiell!
// Ggf. kann man via Parameter den Content Root durchreichen?
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseContentRoot(Path.Combine(Directory.GetCurrentDirectory(), "..", "ElectronNET.WebApp"))
.UseContentRoot(AppDomain.CurrentDomain.BaseDirectory)
.UseStartup<Startup>()
.Build();
}

View File

@@ -1,39 +0,0 @@
ASP.NET MVC core dependencies have been added to the project.
(These dependencies include packages required to enable scaffolding)
However you may still need to do make changes to your project.
1. Suggested changes to Startup class:
1.1 Add a constructor:
public IConfiguration Configuration { get; }
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
1.2 Add MVC services:
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}
1.3 Configure web app to use use Configuration and use MVC routing:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}