Skip to content

Commit 7457b0b

Browse files
committed
updating to .NET Core 3.0
1 parent 267d4ba commit 7457b0b

File tree

6 files changed

+36
-24
lines changed

6 files changed

+36
-24
lines changed

src/AspNetCoreLocalization/package-lock.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ImportExportLocalization/ImportExportLocalization.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
55
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
66
</PropertyGroup>
77

@@ -16,12 +16,13 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="BuildBundlerMinifier" Version="2.9.406" />
19+
<PackageReference Include="BuildBundlerMinifier" Version="3.0.415" />
2020
<PackageReference Include="Microsoft.AspNetCore.App" />
21-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4" PrivateAssets="all">
21+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
22+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0" PrivateAssets="all">
2223
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2324
</PackageReference>
24-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
25+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" />
2526
<PackageReference Include="WebApiContrib.Core.Formatter.Csv" Version="3.0.0" />
2627
</ItemGroup>
2728

0 Bytes
Binary file not shown.
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
using Microsoft.AspNetCore;
22
using Microsoft.AspNetCore.Hosting;
3+
using Microsoft.Extensions.Hosting;
34

45
namespace ImportExportLocalization
56
{
67
public class Program
78
{
89
public static void Main(string[] args)
910
{
10-
CreateWebHostBuilder(args).Build().Run();
11+
CreateHostBuilder(args).Build().Run();
1112
}
1213

13-
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
14-
WebHost.CreateDefaultBuilder(args)
15-
.UseStartup<Startup>();
14+
public static IHostBuilder CreateHostBuilder(string[] args) =>
15+
Host.CreateDefaultBuilder(args)
16+
.ConfigureWebHostDefaults(webBuilder =>
17+
{
18+
webBuilder.UseStartup<Startup>();
19+
});
1620
}
1721
}

src/ImportExportLocalization/Startup.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,18 @@
1212
using Microsoft.Net.Http.Headers;
1313
using WebApiContrib.Core.Formatter.Csv;
1414
using Microsoft.AspNetCore.Mvc;
15+
using Microsoft.Extensions.Hosting;
1516

1617
namespace ImportExportLocalization
1718
{
1819
public class Startup
1920
{
20-
public Startup(IHostingEnvironment env)
21+
public Startup(IConfiguration configuration)
2122
{
22-
var builder = new ConfigurationBuilder()
23-
.SetBasePath(env.ContentRootPath)
24-
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
25-
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
26-
.AddEnvironmentVariables();
27-
Configuration = builder.Build();
23+
Configuration = configuration;
2824
}
2925

30-
public IConfigurationRoot Configuration { get; }
26+
public IConfiguration Configuration { get; }
3127

3228
// This method gets called by the runtime. Use this method to add services to the container.
3329
public void ConfigureServices(IServiceCollection services)
@@ -46,7 +42,8 @@ public void ConfigureServices(IServiceCollection services)
4642
// Requires that LocalizationModelContext is defined
4743
services.AddSqlLocalization(options => options.UseTypeFullNames = true);
4844

49-
services.AddMvc()
45+
services.AddControllersWithViews()
46+
.AddNewtonsoftJson()
5047
.AddViewLocalization()
5148
.AddDataAnnotationsLocalization();
5249

@@ -72,13 +69,13 @@ public void ConfigureServices(IServiceCollection services)
7269
options.InputFormatters.Add(new CsvInputFormatter(csvFormatterOptions));
7370
options.OutputFormatters.Add(new CsvOutputFormatter(csvFormatterOptions));
7471
options.FormatterMappings.SetMediaTypeMappingForFormat("csv", MediaTypeHeaderValue.Parse("text/csv"));
75-
}).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
72+
}).SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
7673

7774
services.AddScoped<ValidateMimeMultipartContentFilter>();
7875
}
7976

8077
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
81-
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
78+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
8279
{
8380
var locOptions = app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>();
8481
app.UseRequestLocalization(locOptions.Value);
@@ -92,13 +89,16 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
9289
app.UseExceptionHandler("/Home/Error");
9390
}
9491

92+
app.UseDefaultFiles();
9593
app.UseStaticFiles();
9694

97-
app.UseMvc(routes =>
95+
app.UseRouting();
96+
97+
app.UseEndpoints(endpoints =>
9898
{
99-
routes.MapRoute(
99+
endpoints.MapControllerRoute(
100100
name: "default",
101-
template: "{controller=Home}/{action=Index}/{id?}");
101+
pattern: "{controller=Home}/{action=Index}/{id?}");
102102
});
103103
}
104104
}

src/ImportExportLocalization/web.config

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
<handlers>
1616
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
1717
</handlers>
18-
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00">
19-
<environmentVariables />
18+
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00" hostingModel="InProcess">
19+
<environmentVariables>
20+
<environmentVariable name="ASPNETCORE_HTTPS_PORT" value="44391" />
21+
<environmentVariable name="COMPLUS_ForceENC" value="1" />
22+
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
23+
</environmentVariables>
2024
</aspNetCore>
2125
</system.webServer>
2226
</configuration>

0 commit comments

Comments
 (0)