AB#6233 - Install in .NET Core

This commit is contained in:
Bjarke Berg
2020-04-20 12:20:47 +02:00
parent 9335f39495
commit 79e9235338
59 changed files with 1593 additions and 350 deletions

View File

@@ -1,18 +1,22 @@
using System;
using System.Data.Common;
using System.Data.SqlClient;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json.Serialization;
using Umbraco.Composing;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Web.BackOffice.AspNetCore;
using Umbraco.Web.Common.AspNetCore;
using Umbraco.Web.Common.Extensions;
using Umbraco.Web.Common.Filters;
using Umbraco.Web.Website.AspNetCore;
using IHostingEnvironment = Umbraco.Core.Hosting.IHostingEnvironment;
@@ -44,10 +48,24 @@ namespace Umbraco.Web.UI.BackOffice
{
services.AddUmbracoConfiguration(_config);
services.AddUmbracoRuntimeMinifier(_config);
// need to manually register this factory
DbProviderFactories.RegisterFactory(Constants.DbProviderNames.SqlServer, SqlClientFactory.Instance);
services.AddUmbracoCore(_env, out var factory);
services.AddUmbracoWebsite();
services.AddMvc();
services.AddMvc(options =>
{
options.Filters.Add<HttpResponseExceptionFilter>();
}).SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
})
;
services.AddMiniProfiler(options =>
{
options.ShouldProfile = request => false; // WebProfiler determine and start profiling. We should not use the MiniProfilerMiddleware to also profile
@@ -87,6 +105,16 @@ namespace Umbraco.Web.UI.BackOffice
Controller = "BackOffice",
Action = "Default"
});
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller}/{action=Index}/{id?}");
endpoints.MapControllerRoute("Install", "/install/{controller}/{Action}", defaults:new { Area = "Install"});
//TODO register routing correct: Name must be like this
endpoints.MapControllerRoute("umbraco-api-UmbracoInstall-InstallApi", "/install/api/{Action}", defaults:new { Area = "Install", Controller = "InstallApi"});
endpoints.MapGet("/", async context =>
{
await context.Response.WriteAsync($"<html><body>Hello World!{Current.Profiler.Render()}</body></html>");

View File

@@ -6,6 +6,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.PublishedCache.NuCache\Umbraco.PublishedCache.NuCache.csproj" />
<ProjectReference Include="..\Umbraco.Web.BackOffice\Umbraco.Web.BackOffice.csproj" />
<ProjectReference Include="..\Umbraco.Web.Common\Umbraco.Web.Common.csproj" />
<ProjectReference Include="..\Umbraco.Web.Website\Umbraco.Web.Website.csproj" />
@@ -13,26 +14,40 @@
<ItemGroup>
<Folder Include="wwwroot\Media" />
<Folder Include="wwwroot\Umbraco\views\install" />
</ItemGroup>
<ItemGroup>
<Compile Remove="wwwroot\Umbraco\**" />
<Compile Remove="App_Data\**" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Remove="wwwroot\Umbraco\**" />
<EmbeddedResource Remove="App_Data\**" />
</ItemGroup>
<ItemGroup>
<None Remove="wwwroot\Umbraco\**" />
<None Remove="App_Data\**" />
</ItemGroup>
<ItemGroup>
<Content Remove="wwwroot\Umbraco\**" />
<Content Remove="App_Data\**" />
<Content Remove="wwwroot\Umbraco\views\install\machinekey.html" />
<Content Remove="wwwroot\Umbraco\views\install\permissionsreport.html" />
<Content Remove="wwwroot\Umbraco\views\install\starterkit.html" />
<Content Remove="wwwroot\Umbraco\views\install\upgrade.html" />
<Content Remove="wwwroot\Umbraco\views\install\user.html" />
<Content Remove="wwwroot\Umbraco\views\install\version7upgradereport.html" />
<Content Remove="wwwroot\Umbraco\views\install\continueinstall.html" />
<Content Remove="wwwroot\Umbraco\views\install\database.html" />
<Content Remove="wwwroot\Umbraco\views\install\error.html" />
<Content Update="Views\Install\Index.cshtml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.3" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,76 @@
@using Umbraco.Web
@{
Layout = null;
}
<!doctype html>
<html lang="en">
<head>
<base href="@ViewData.GetUmbracoBaseFolder()/" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Install Umbraco</title>
<link rel="stylesheet" href="assets/css/installer.css" />
</head>
<body ng-class="{loading:installer.loading}" ng-controller="Umbraco.InstallerController" id="umbracoInstallPageBody">
<img src="assets/img/application/logo_white.png" id="logo" />
<umb-loader position="bottom"
class="umb-installer-loader"
ng-if="installer.loading"
ng-style="{'width': installer.progress}">
</umb-loader>
<div id="overlay" ng-cloak ng-animate="'fade'" ng-show="installer.done"></div>
<div id="installer" class="absolute-center clearfix"
ng-cloak
ng-animate="'fade'"
ng-show="installer.configuring">
<div ng-if="installer.current" ng-switch on="installer.current.view">
<div ng-switch-when="ysod">
<h1>A server error occurred</h1>
<p>This is most likely due to an error during application startup</p>
<iframe id="ysod"></iframe>
</div>
<div ng-switch-default>
<div ng-include="installer.current.view"></div>
</div>
</div>
</div>
<div ng-cloak ng-animate="'fade'" id="fact" class="absolute-center clearfix" ng-show="installer.fact">
<h2>Did you know</h2>
<p ng-bind-html="installer.fact"></p>
</div>
<h3 ng-cloak ng-animate="'fade'" id="feedback" ng-show="installer.feedback">{{installer.feedback}}</h3>
<div id="missinglazyload" style="display: none;">
<h3>There has been a problem with the build.</h3>
<p>This might be because you could be offline or on a slow connection. Please try the following steps</p>
<ol>
<li>Make sure you have <a href="https://nodejs.org" target="_blank">Node.js</a> installed.</li>
<li>Open command prompt and cd to \src\Umbraco.Web.UI.Client.</li>
<li>Check to see if \src\Umbraco.Web.UI.Client\node_modules folder exists (this could be hidden); if so delete it.</li>
<li>Run npm install; if successfull the node_modules folder should be created in the Umbraco.Web.UI.Client directory.</li>
<li>Run build\Build.bat.</li>
</ol>
</div>
<script type="text/javascript">
var Umbraco = {};
Umbraco.Sys = {};
Umbraco.Sys.ServerVariables = {
"installApiBaseUrl": "@ViewData.GetInstallApiBaseUrl()",
"umbracoBaseUrl": "@ViewData.GetUmbracoBaseFolder()"
};
</script>
<script src="lib/lazyload-js/lazyload.min.js"></script>
<script src="js/install.loader.js"></script>
</body>
</html>