Update to .NET Core 3.0

This commit is contained in:
RaidMax
2019-09-30 18:35:36 -05:00
parent 260a8800a4
commit 524589717b
18 changed files with 40 additions and 102 deletions

View File

@ -13,10 +13,10 @@ namespace WebfrontCore
{
public class Startup
{
private readonly IHostingEnvironment _appHost;
private readonly IWebHostEnvironment _appHost;
public static IConfigurationRoot Configuration { get; private set; }
public Startup(IHostingEnvironment env)
public Startup(IWebHostEnvironment env)
{
var builder = new ConfigurationBuilder()
.AddEnvironmentVariables();
@ -37,13 +37,12 @@ namespace WebfrontCore
{
_builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials();
.AllowAnyHeader();
});
});
// Add framework services.
var mvcBuilder = services.AddMvc()
var mvcBuilder = services.AddMvc(_options => _options.SuppressAsyncSuffixInActionNames = false)
.ConfigureApplicationPartManager(_ =>
{
foreach (var assembly in Program.Manager.GetPluginAssemblies())
@ -61,7 +60,7 @@ namespace WebfrontCore
});
#if DEBUG
mvcBuilder = mvcBuilder.AddRazorOptions(options => options.AllowRecompilingViewsOnFileChange = true);
mvcBuilder = mvcBuilder.AddRazorRuntimeCompilation();
services.Configure<RazorViewEngineOptions>(_options =>
{
_options.ViewLocationFormats.Add(@"/Views/Plugins/{1}/{0}" + RazorViewEngine.ViewExtension);
@ -94,9 +93,9 @@ namespace WebfrontCore
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
if (env.IsDevelopment())
if (env.EnvironmentName == "Development")
{
app.UseDeveloperExceptionPage();
}
@ -115,11 +114,10 @@ namespace WebfrontCore
app.UseAuthentication();
app.UseCors("AllowAll");
app.UseMvc(routes =>
app.UseRouting();
app.UseEndpoints(endpoints =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
});
}
}

View File

@ -17,8 +17,6 @@ namespace WebfrontCore.TagHelpers
output.TagName = "ColorCode";
output.TagMode = TagMode.StartTagAndEndTag;
if (Allow)
{
var matches = Regex.Matches(Value, @"\^([0-9]|\:)([^\^]*)");

View File

@ -51,9 +51,8 @@
if (property.PropertyType.Name == typeof(System.Boolean).Name)
{
var attributes = linkedPropertyNames.Length > 0 ? new { htmlAttributes = new { @class = "has-related-content mb-0", data_related_content = string.Join(',', linkedPropertyNames.Select(_id => $"#{_id}_content")) } } : null;
<div class="form-group form-check bg-primary mb-0 pl-3 pr-3 p-2">
@Html.Editor(property.Name, attributes)
@Html.Editor(property.Name, linkedPropertyNames.Length > 0 ? new { htmlAttributes = new { @class= "has-related-content mb-0", data_related_content = string.Join(',', linkedPropertyNames.Select(_id => $"#{_id}_content")) } } : null)
@Html.Label(property.Name, null, new { @class = "form-check-label ml-1" })
</div>
}

View File

@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
<TargetFramework>netcoreapp3.0</TargetFramework>
<RazorCompileOnBuild Condition="'$(CONFIG)'!='Debug'">true</RazorCompileOnBuild>
<RazorCompiledOnPublish Condition="'$(CONFIG)'!='Debug'">true</RazorCompiledOnPublish>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<PreserveCompilationContext>true</PreserveCompilationContext>
<TypeScriptToolsVersion>2.6</TypeScriptToolsVersion>
<PackageId>RaidMax.IW4MAdmin.WebfrontCore</PackageId>
@ -68,18 +68,8 @@
<ItemGroup>
<PackageReference Include="Bower" Version="1.3.11" />
<PackageReference Include="BuildBundlerMinifier" Version="2.9.406" />
<PackageReference Include="Microsoft.AspNetCore" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Update="Microsoft.NETCore.App" Version="2.2.2" />
<PackageReference Update="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="BuildBundlerMinifier" Version="3.0.415" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.0.0" />
</ItemGroup>
<ItemGroup>