From f24a32b201c7793707b76f7c98d425ecbc7c1be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 6 Sep 2019 10:40:58 +0300 Subject: [PATCH] Make bootstrap demo running --- ....Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj | 4 --- .../AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs | 3 ++- .../Volo.Abp.AspNetCore.TestBase.csproj | 2 +- .../Properties/launchSettings.json | 27 +++++++++++++++++++ .../Volo.Abp.AspNetCore.Mvc.Tests.csproj | 3 +-- .../AbpAspNetCoreMvcUiBootstrapDemoModule.cs | 10 ++++++- .../Program.cs | 26 +++++++++++------- .../Startup.cs | 4 +-- .../Properties/launchSettings.json | 27 +++++++++++++++++++ .../Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj | 3 +-- .../Properties/launchSettings.json | 27 +++++++++++++++++++ ...Abp.AspNetCore.Mvc.Versioning.Tests.csproj | 3 +-- 12 files changed, 115 insertions(+), 24 deletions(-) create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Properties/launchSettings.json create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Properties/launchSettings.json create mode 100644 framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Properties/launchSettings.json diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj index 87932d6284..258feaf64a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj @@ -32,10 +32,6 @@ - - - - diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs index f1586777cf..c0cd48eece 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs @@ -86,8 +86,9 @@ namespace Volo.Abp.AspNetCore.Mvc var resourceType = abpMvcDataAnnotationsLocalizationOptions.AssemblyResources.GetOrDefault(type.Assembly); return factory.Create(resourceType ?? type); }; - }) + }) .AddViewLocalization(); //TODO: How to configure from the application? Also, consider to move to a UI module since APIs does not care about it. + context.Services.ExecutePreConfiguredActions(mvcBuilder); diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj index 7ae36df117..e08579cdb7 100644 --- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj +++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj @@ -22,7 +22,7 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Properties/launchSettings.json b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Properties/launchSettings.json new file mode 100644 index 0000000000..fcf34f54da --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:55482/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Volo.Abp.AspNetCore.Mvc.Tests": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:55483/" + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj index 2f956ce4b2..693ab112f3 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -19,7 +19,6 @@ - diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/AbpAspNetCoreMvcUiBootstrapDemoModule.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/AbpAspNetCoreMvcUiBootstrapDemoModule.cs index ce9734914d..990de18071 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/AbpAspNetCoreMvcUiBootstrapDemoModule.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/AbpAspNetCoreMvcUiBootstrapDemoModule.cs @@ -22,9 +22,17 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo app.UseDeveloperExceptionPage(); } + app.UseRouting(); + app.UseVirtualFiles(); - app.UseMvcWithDefaultRoute(); + //app.UseMvcWithDefaultRoute(); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}"); + endpoints.MapRazorPages(); + }); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs index 4ee4949d50..0941475418 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Program.cs @@ -1,6 +1,7 @@ using System; using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; @@ -20,7 +21,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo try { Log.Information("Starting web host."); - BuildWebHostInternal(args).Run(); + BuildWebHostInternal(args).Build().Run(); return 0; } catch (Exception ex) @@ -34,13 +35,20 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo } } - internal static IWebHost BuildWebHostInternal(string[] args) => - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIISIntegration() - .UseStartup() - .UseSerilog() - .Build(); + //internal static IWebHost BuildWebHostInternal(string[] args) => + // new WebHostBuilder() + // .UseKestrel() + // .UseContentRoot(Directory.GetCurrentDirectory()) + // .UseIISIntegration() + // .UseStartup() + // .UseSerilog() + // .Build(); + + internal static IHostBuilder BuildWebHostInternal(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs index ffd3ca47be..0497fe5216 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Startup.cs @@ -7,14 +7,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo { public class Startup { - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { services.AddApplication(options => { options.UseAutofac(); }); - return services.BuildServiceProviderFromFactory(); + //return services.BuildServiceProviderFromFactory(); } public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Properties/launchSettings.json b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Properties/launchSettings.json new file mode 100644 index 0000000000..9e97dc2b61 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:55480/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Volo.Abp.AspNetCore.Mvc.UI.Tests": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:55481/" + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj index cc1af553f8..b63efadfda 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -15,7 +15,6 @@ - diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Properties/launchSettings.json b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Properties/launchSettings.json new file mode 100644 index 0000000000..836bd1af47 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:55487/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Volo.Abp.AspNetCore.Mvc.Versioning.Tests": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:55488/" + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj index 139bae1588..8d954b0b2a 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -15,7 +15,6 @@ -