Skip to content

Commit 3acab0d

Browse files
committed
Merge branch 'feature/aspnet_core_2.1'
* feature/aspnet_core_2.1: Update gitattribute templates Update licenses Add VS Code assets Update project to ASP.NET Core 2.1 rc1
2 parents 667329b + c15cdd5 commit 3acab0d

14 files changed

+98
-82
lines changed

.vscode/launch.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (web)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
"program": "${workspaceFolder}/src/bin/Debug/netcoreapp2.1/gitattributes.dll",
13+
"args": [],
14+
"cwd": "${workspaceFolder}/src",
15+
"stopAtEntry": false,
16+
"internalConsoleOptions": "openOnSessionStart",
17+
"launchBrowser": {
18+
"enabled": true,
19+
"args": "${auto-detect-url}",
20+
"windows": {
21+
"command": "cmd.exe",
22+
"args": "/C start ${auto-detect-url}"
23+
},
24+
"osx": {
25+
"command": "open"
26+
},
27+
"linux": {
28+
"command": "xdg-open"
29+
}
30+
},
31+
"env": {
32+
"ASPNETCORE_ENVIRONMENT": "Development"
33+
},
34+
"sourceFileMap": {
35+
"/Views": "${workspaceFolder}/Views"
36+
}
37+
},
38+
{
39+
"name": ".NET Core Attach",
40+
"type": "coreclr",
41+
"request": "attach",
42+
"processId": "${command:pickProcess}"
43+
}
44+
]
45+
}

.vscode/tasks.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/src/gitattributes.csproj"
11+
],
12+
"problemMatcher": "$msCompile"
13+
}
14+
]
15+
}

AUTHORS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Jozef Izso
1+
gitattributes website by Jozef Izso
2+
gitattributes templates by Alexander Karatarakis

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2016 Jozef Izso
3+
Copyright (c) 2015-2018 Jozef Izso
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55

66
## License
77

8-
Copyright (c) 2015-2016 Jozef Izso, [MIT License](LICENSE)
8+
Copyright (c) 2015-2018 Jozef Izso, [MIT License](LICENSE)
9+
10+
gitattribute templates are provided by [alexkaratarakis/gitattributes](https://github.com/alexkaratarakis/gitattributes)

gitattributes.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 15
3-
VisualStudioVersion = 15.0.26730.16
3+
VisualStudioVersion = 15.0.27703.2018
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CFCC326F-2A99-4985-8612-50C8DB63DBA3}"
66
ProjectSection(SolutionItems) = preProject

src/Program.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.IO;
3+
using Microsoft.AspNetCore;
34
using Microsoft.AspNetCore.Hosting;
45

56
namespace GitAttributesWeb
@@ -8,14 +9,14 @@ public class Program
89
{
910
public static void Main(string[] args)
1011
{
11-
var host = new WebHostBuilder()
12-
.UseKestrel()
13-
.UseContentRoot(Directory.GetCurrentDirectory())
14-
.UseIISIntegration()
15-
.UseStartup<Startup>()
16-
.Build();
12+
CreateWebHostBuilder(args).Build().Run();
13+
}
1714

18-
host.Run();
15+
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
16+
{
17+
return WebHost.CreateDefaultBuilder(args)
18+
.UseApplicationInsights()
19+
.UseStartup<Startup>();
1920
}
2021
}
2122
}

src/Startup.cs

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using GitAttributesWeb.Utils;
66
using Microsoft.AspNetCore.Builder;
77
using Microsoft.AspNetCore.Hosting;
8+
using Microsoft.AspNetCore.Http;
89
using Microsoft.AspNetCore.Mvc;
910
using Microsoft.Extensions.Configuration;
1011
using Microsoft.Extensions.DependencyInjection;
@@ -15,25 +16,12 @@ namespace GitAttributesWeb
1516
{
1617
public class Startup
1718
{
18-
public Startup(IHostingEnvironment env)
19+
public Startup(IConfiguration configuration)
1920
{
20-
// Setup configuration sources.
21-
var configuration = new ConfigurationBuilder()
22-
.SetBasePath(env.ContentRootPath)
23-
.AddJsonFile("config.json", optional: false, reloadOnChange: true)
24-
.AddJsonFile($"config.{env.EnvironmentName}.json", optional: true);
25-
26-
if (env.IsDevelopment())
27-
{
28-
configuration.AddApplicationInsightsSettings(developerMode: true);
29-
}
30-
31-
configuration.AddEnvironmentVariables();
32-
33-
this.Configuration = configuration.Build();
21+
Configuration = configuration;
3422
}
3523

36-
public IConfigurationRoot Configuration { get; set; }
24+
public IConfiguration Configuration { get; set; }
3725

3826
// This method gets called by the runtime. Use this method to add services to the container.
3927
public void ConfigureServices(IServiceCollection services)
@@ -42,8 +30,14 @@ public void ConfigureServices(IServiceCollection services)
4230

4331
services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
4432

33+
services.Configure<CookiePolicyOptions>(options =>
34+
{
35+
options.CheckConsentNeeded = context => false;
36+
options.MinimumSameSitePolicy = SameSiteMode.None;
37+
});
38+
4539
// Add MVC services to the services container.
46-
services.AddMvc();
40+
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
4741
services.Configure<MvcOptions>(options =>
4842
{
4943
options.OutputFormatters.Clear();
@@ -58,12 +52,6 @@ public void ConfigureServices(IServiceCollection services)
5852
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
5953
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
6054
{
61-
loggerFactory.AddConsole(this.Configuration.GetSection("Logging"));
62-
loggerFactory.AddDebug();
63-
64-
// Add Application Insights monitoring to the request pipeline as a very first middleware.
65-
app.UseApplicationInsightsRequestTelemetry();
66-
6755
// configure Content Security Policy policy
6856
app.UseCsp(options =>
6957
{
@@ -84,37 +72,23 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
8472
// configure X-XSS-Protection policy
8573
app.UseXXssProtection(options => options.EnabledWithBlockMode());
8674

87-
// Add the following to the request pipeline only in development environment.
8875
if (env.IsDevelopment())
8976
{
9077
app.UseDeveloperExceptionPage();
91-
app.UseBrowserLink();
9278
}
9379
else
9480
{
81+
app.UseExceptionHandler("/Home/Error");
82+
9583
// configure HTTP Strict Transport Security policy
9684
app.UseHsts(options =>
9785
{
9886
options.MaxAge(days: 30).IncludeSubdomains();
9987
});
100-
101-
////// configure HTTP Public Key Pinning policy
102-
////app.UseHpkpReportOnly(options =>
103-
////{
104-
//// options.MaxAge(days: 30)
105-
//// .Sha256Pins("OckhHQiygSnN1Rw3EX+AhE/pd3osjeGq2YuWT9UoDHI=")
106-
//// .ReportUri("https://goit.report-uri.io/r/default/hpkp/reportOnly");
107-
////});
108-
109-
// Add Error handling middleware which catches all application specific errors and
110-
// send the request to the following path or controller action.
111-
app.UseExceptionHandler("/Home/Error");
11288
}
11389

114-
app.UseApplicationInsightsExceptionTelemetry();
115-
116-
// Add static files to the request pipeline.
11790
app.UseStaticFiles();
91+
app.UseCookiePolicy();
11892

11993
// Add MVC to the request pipeline.
12094
app.UseMvc(routes =>

src/Views/Shared/_Layout.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<script type="text/javascript" src="~/lib/bootswatch-dist/js/bootstrap.min.js"></script>
1515
<script type="text/javascript" src="~/lib/selectize/js/selectize.js"></script>
1616

17-
<environment names="prod">
18-
@Html.ApplicationInsightsJavaScript(TelemetryConfiguration)
17+
<environment names="Production">
18+
@Html.Raw(JavaScriptSnippet.FullScript)
1919
</environment>
2020
</head>
2121
<body>

src/Views/_ViewImports.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@using GitAttributesWeb
22
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
3+
@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
File renamed without changes.
File renamed without changes.

src/gitattributes.csproj

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

33
<PropertyGroup>
4-
<VersionPrefix>1.1.0</VersionPrefix>
5-
<TargetFramework>netcoreapp1.0</TargetFramework>
6-
<PreserveCompilationContext>true</PreserveCompilationContext>
4+
<VersionPrefix>1.2.0</VersionPrefix>
5+
<TargetFramework>netcoreapp2.1</TargetFramework>
76
<AssemblyName>gitattributes</AssemblyName>
8-
<OutputType>Exe</OutputType>
97
<PackageId>gitattributes</PackageId>
10-
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
11-
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
128
</PropertyGroup>
139

1410
<ItemGroup>
15-
<None Update="wwwroot\**\*;Views\**\*">
16-
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
17-
</None>
18-
</ItemGroup>
19-
20-
<ItemGroup>
21-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.3" />
22-
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.2" />
23-
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.0.2" />
24-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.0.2" />
25-
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.0.2" />
26-
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.0.2" />
27-
<PackageReference Include="NWebsec.AspNetCore.Middleware" Version="1.0.0-gamma1-15" />
28-
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.0.2" />
29-
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.3" />
30-
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.2" />
31-
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.0.2" />
32-
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.2" />
33-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.2" />
34-
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="1.0.0" />
35-
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1" />
11+
<PackageReference Include="Microsoft.AspNetCore.App" />
12+
<PackageReference Include="NWebsec.AspNetCore.Middleware" Version="2.0.0" />
13+
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.3.0" />
3614
</ItemGroup>
3715

3816
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
@@ -43,7 +21,6 @@
4321

4422
<ItemGroup>
4523
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
46-
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
4724
</ItemGroup>
4825

4926
</Project>

0 commit comments

Comments
 (0)