Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e9ca434

Browse filesBrowse files
Update all templates to match latest "yo aspnet" output
1 parent de960d8 commit e9ca434
Copy full SHA for e9ca434

File tree

Expand file treeCollapse file tree

20 files changed

+311
-299
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

20 files changed

+311
-299
lines changed
Open diff view settings
Collapse file

‎templates/Angular2Spa/Program.cs‎

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore.Hosting;
7+
using Microsoft.Extensions.Configuration;
8+
9+
namespace WebApplicationBasic
10+
{
11+
public class Program
12+
{
13+
public static void Main(string[] args)
14+
{
15+
var config = new ConfigurationBuilder()
16+
.AddCommandLine(args)
17+
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
18+
.Build();
19+
20+
var host = new WebHostBuilder()
21+
.UseConfiguration(config)
22+
.UseKestrel()
23+
.UseContentRoot(Directory.GetCurrentDirectory())
24+
.UseIISIntegration()
25+
.UseStartup<Startup>()
26+
.Build();
27+
28+
host.Run();
29+
}
30+
}
31+
}
Collapse file

‎templates/Angular2Spa/Startup.cs‎

Copy file name to clipboard
+26-23Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,57 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.IO;
43
using System.Linq;
54
using System.Threading.Tasks;
65
using Microsoft.AspNetCore.Builder;
76
using Microsoft.AspNetCore.Hosting;
8-
using Microsoft.AspNetCore.Http;
97
using Microsoft.AspNetCore.SpaServices.Webpack;
8+
using Microsoft.Extensions.Configuration;
109
using Microsoft.Extensions.DependencyInjection;
1110
using Microsoft.Extensions.Logging;
12-
using Newtonsoft.Json.Serialization;
1311

1412
namespace WebApplicationBasic
1513
{
1614
public class Startup
1715
{
16+
public Startup(IHostingEnvironment env)
17+
{
18+
var builder = new ConfigurationBuilder()
19+
.SetBasePath(env.ContentRootPath)
20+
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
21+
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
22+
.AddEnvironmentVariables();
23+
Configuration = builder.Build();
24+
}
25+
26+
public IConfigurationRoot Configuration { get; }
27+
1828
// This method gets called by the runtime. Use this method to add services to the container.
1929
public void ConfigureServices(IServiceCollection services)
2030
{
21-
services.AddMvc().AddJsonOptions(options =>
22-
{
23-
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
24-
});
31+
// Add framework services.
32+
services.AddMvc();
2533
}
2634

2735
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
28-
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env)
36+
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
2937
{
30-
app.UseDeveloperExceptionPage();
38+
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
39+
loggerFactory.AddDebug();
3140

32-
if (env.IsDevelopment()) {
41+
if (env.IsDevelopment())
42+
{
43+
app.UseDeveloperExceptionPage();
3344
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
3445
HotModuleReplacement = true
3546
});
3647
}
48+
else
49+
{
50+
app.UseExceptionHandler("/Home/Error");
51+
}
3752

3853
app.UseStaticFiles();
39-
loggerFactory.AddConsole();
54+
4055
app.UseMvc(routes =>
4156
{
4257
routes.MapRoute(
@@ -48,17 +63,5 @@ public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHo
4863
defaults: new { controller = "Home", action = "Index" });
4964
});
5065
}
51-
52-
public static void Main(string[] args)
53-
{
54-
var host = new WebHostBuilder()
55-
.UseContentRoot(Directory.GetCurrentDirectory())
56-
.UseIISIntegration()
57-
.UseKestrel()
58-
.UseStartup<Startup>()
59-
.Build();
60-
61-
host.Run();
62-
}
6366
}
6467
}
Collapse file

‎templates/Angular2Spa/appsettings.json‎

Copy file name to clipboardExpand all lines: templates/Angular2Spa/appsettings.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"Logging": {
33
"IncludeScopes": false,
44
"LogLevel": {
5-
"Default": "Verbose",
5+
"Default": "Debug",
66
"System": "Information",
77
"Microsoft": "Information"
88
}
Collapse file

‎templates/Angular2Spa/project.json‎

Copy file name to clipboardExpand all lines: templates/Angular2Spa/project.json
+4-37Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"version": "1.0.0",
55
"type": "platform"
66
},
7-
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
87
"Microsoft.AspNetCore.AngularServices": "1.0.0-*",
98
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
109
"Microsoft.AspNetCore.Mvc": "1.0.0",
@@ -17,61 +16,29 @@
1716
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
1817
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
1918
"Microsoft.Extensions.Configuration.Json": "1.0.0",
19+
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
2020
"Microsoft.Extensions.Logging": "1.0.0",
2121
"Microsoft.Extensions.Logging.Console": "1.0.0",
2222
"Microsoft.Extensions.Logging.Debug": "1.0.0",
23-
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
24-
"version": "1.0.0-preview2-final",
25-
"type": "build"
26-
},
27-
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
28-
"version": "1.0.0-preview2-final",
29-
"type": "build"
30-
}
23+
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0"
3124
},
3225

3326
"tools": {
34-
"Microsoft.AspNetCore.Razor.Tools": {
35-
"version": "1.0.0-preview2-final",
36-
"imports": "portable-net45+win8+dnxcore50"
37-
},
38-
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
39-
"version": "1.0.0-preview2-final",
40-
"imports": "portable-net45+win8+dnxcore50"
41-
},
42-
"Microsoft.EntityFrameworkCore.Tools": {
43-
"version": "1.0.0-preview2-final",
44-
"imports": [
45-
"portable-net45+win8+dnxcore50",
46-
"portable-net45+win8"
47-
]
48-
},
49-
"Microsoft.Extensions.SecretManager.Tools": {
50-
"version": "1.0.0-preview2-final",
51-
"imports": "portable-net45+win8+dnxcore50"
52-
},
53-
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
54-
"version": "1.0.0-preview2-final",
55-
"imports": [
56-
"portable-net45+win8+dnxcore50",
57-
"portable-net45+win8"
58-
]
59-
},
27+
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
28+
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
6029
"Microsoft.DotNet.Watcher.Tools": "1.0.0-preview2-final"
6130
},
6231

6332
"frameworks": {
6433
"netcoreapp1.0": {
6534
"imports": [
6635
"dotnet5.6",
67-
"dnxcore50",
6836
"portable-net45+win8"
6937
]
7038
}
7139
},
7240

7341
"buildOptions": {
74-
"debugType": "portable",
7542
"emitEntryPoint": true,
7643
"preserveCompilationContext": true
7744
},
Collapse file

‎templates/KnockoutSpa/Program.cs‎

Copy file name to clipboard
+31Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore.Hosting;
7+
using Microsoft.Extensions.Configuration;
8+
9+
namespace WebApplicationBasic
10+
{
11+
public class Program
12+
{
13+
public static void Main(string[] args)
14+
{
15+
var config = new ConfigurationBuilder()
16+
.AddCommandLine(args)
17+
.AddEnvironmentVariables(prefix: "ASPNETCORE_")
18+
.Build();
19+
20+
var host = new WebHostBuilder()
21+
.UseConfiguration(config)
22+
.UseKestrel()
23+
.UseContentRoot(Directory.GetCurrentDirectory())
24+
.UseIISIntegration()
25+
.UseStartup<Startup>()
26+
.Build();
27+
28+
host.Run();
29+
}
30+
}
31+
}
Collapse file

‎templates/KnockoutSpa/Startup.cs‎

Copy file name to clipboard
+26-23Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,57 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.IO;
43
using System.Linq;
54
using System.Threading.Tasks;
65
using Microsoft.AspNetCore.Builder;
76
using Microsoft.AspNetCore.Hosting;
8-
using Microsoft.AspNetCore.Http;
97
using Microsoft.AspNetCore.SpaServices.Webpack;
8+
using Microsoft.Extensions.Configuration;
109
using Microsoft.Extensions.DependencyInjection;
1110
using Microsoft.Extensions.Logging;
12-
using Newtonsoft.Json.Serialization;
1311

1412
namespace WebApplicationBasic
1513
{
1614
public class Startup
1715
{
16+
public Startup(IHostingEnvironment env)
17+
{
18+
var builder = new ConfigurationBuilder()
19+
.SetBasePath(env.ContentRootPath)
20+
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
21+
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
22+
.AddEnvironmentVariables();
23+
Configuration = builder.Build();
24+
}
25+
26+
public IConfigurationRoot Configuration { get; }
27+
1828
// This method gets called by the runtime. Use this method to add services to the container.
1929
public void ConfigureServices(IServiceCollection services)
2030
{
21-
services.AddMvc().AddJsonOptions(options =>
22-
{
23-
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
24-
});
31+
// Add framework services.
32+
services.AddMvc();
2533
}
2634

2735
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
28-
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env)
36+
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
2937
{
30-
app.UseDeveloperExceptionPage();
38+
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
39+
loggerFactory.AddDebug();
3140

32-
if (env.IsDevelopment()) {
41+
if (env.IsDevelopment())
42+
{
43+
app.UseDeveloperExceptionPage();
3344
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
3445
HotModuleReplacement = true
3546
});
3647
}
48+
else
49+
{
50+
app.UseExceptionHandler("/Home/Error");
51+
}
3752

3853
app.UseStaticFiles();
39-
loggerFactory.AddConsole();
54+
4055
app.UseMvc(routes =>
4156
{
4257
routes.MapRoute(
@@ -48,17 +63,5 @@ public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHo
4863
defaults: new { controller = "Home", action = "Index" });
4964
});
5065
}
51-
52-
public static void Main(string[] args)
53-
{
54-
var host = new WebHostBuilder()
55-
.UseContentRoot(Directory.GetCurrentDirectory())
56-
.UseIISIntegration()
57-
.UseKestrel()
58-
.UseStartup<Startup>()
59-
.Build();
60-
61-
host.Run();
62-
}
6366
}
6467
}
Collapse file

‎templates/KnockoutSpa/appsettings.json‎

Copy file name to clipboardExpand all lines: templates/KnockoutSpa/appsettings.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"Logging": {
33
"IncludeScopes": false,
44
"LogLevel": {
5-
"Default": "Verbose",
5+
"Default": "Debug",
66
"System": "Information",
77
"Microsoft": "Information"
88
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.