Skip to content

Commit 649c607

Browse files
Update WebApplicationBasic template to RC2
1 parent 280979c commit 649c607

File tree

4 files changed

+43
-48
lines changed

4 files changed

+43
-48
lines changed

templates/WebApplicationBasic/Controllers/HomeController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5-
using Microsoft.AspNet.Mvc;
5+
using Microsoft.AspNetCore.Mvc;
66

77
namespace WebApplicationBasic.Controllers
88
{
Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,31 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.IO;
34
using System.Linq;
45
using System.Threading.Tasks;
5-
using Microsoft.AspNet.Builder;
6-
using Microsoft.AspNet.Hosting;
7-
using Microsoft.Extensions.Configuration;
6+
using Microsoft.AspNetCore.Builder;
7+
using Microsoft.AspNetCore.Hosting;
8+
using Microsoft.AspNetCore.Http;
89
using Microsoft.Extensions.DependencyInjection;
910
using Microsoft.Extensions.Logging;
1011

1112
namespace WebApplicationBasic
1213
{
1314
public class Startup
1415
{
15-
public Startup(IHostingEnvironment env)
16-
{
17-
// Set up configuration sources.
18-
var builder = new ConfigurationBuilder()
19-
.AddJsonFile("appsettings.json")
20-
.AddEnvironmentVariables();
21-
Configuration = builder.Build();
22-
}
23-
24-
public IConfigurationRoot Configuration { get; set; }
25-
2616
// This method gets called by the runtime. Use this method to add services to the container.
2717
public void ConfigureServices(IServiceCollection services)
2818
{
29-
// Add framework services.
3019
services.AddMvc();
3120
}
3221

3322
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
34-
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
23+
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env)
3524
{
36-
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
37-
loggerFactory.AddDebug();
38-
39-
if (env.IsDevelopment())
40-
{
41-
app.UseDeveloperExceptionPage();
42-
}
43-
else
44-
{
45-
app.UseExceptionHandler("/Home/Error");
46-
}
47-
48-
app.UseIISPlatformHandler();
25+
app.UseDeveloperExceptionPage();
4926

5027
app.UseStaticFiles();
51-
28+
loggerFactory.AddConsole();
5229
app.UseMvc(routes =>
5330
{
5431
routes.MapRoute(
@@ -57,7 +34,17 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
5734
});
5835
}
5936

60-
// Entry point for the application.
61-
public static void Main(string[] args) => Microsoft.AspNet.Hosting.WebApplication.Run<Startup>(args);
37+
public static void Main(string[] args)
38+
{
39+
var host = new WebHostBuilder()
40+
.UseContentRoot(Directory.GetCurrentDirectory())
41+
.UseDefaultHostingConfiguration(args)
42+
.UseIISPlatformHandlerUrl()
43+
.UseKestrel()
44+
.UseStartup<Startup>()
45+
.Build();
46+
47+
host.Run();
48+
}
6249
}
6350
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
@using WebApplicationBasic
2-
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
2+
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"

templates/WebApplicationBasic/project.json

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
{
22
"version": "1.0.0-*",
33
"compilationOptions": {
4-
"emitEntryPoint": true
4+
"emitEntryPoint": true,
5+
"warningsAsErrors": true,
6+
"preserveCompilationContext": true
57
},
68
"tooling": {
79
"defaultNamespace": "WebApplicationBasic"
810
},
911

1012
"dependencies": {
11-
"Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
12-
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
13-
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
14-
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
15-
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
16-
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
17-
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
18-
"Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-final",
19-
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
20-
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
21-
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
22-
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final"
13+
"Microsoft.AspNetCore.Diagnostics": "1.0.0-*",
14+
"Microsoft.AspNetCore.IISPlatformHandler": "1.0.0-*",
15+
"Microsoft.AspNetCore.Mvc": "1.0.0-*",
16+
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0-*",
17+
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-*",
18+
"Microsoft.AspNetCore.StaticFiles": "1.0.0-*",
19+
"Microsoft.Extensions.Configuration.Json": "1.0.0-*",
20+
"Microsoft.Extensions.Logging.Console": "1.0.0-*",
21+
"Microsoft.NETCore.Platforms": "1.0.1-*",
22+
"Microsoft.Extensions.Logging.Debug": "1.0.0-*"
2323
},
2424

2525
"commands": {
@@ -28,7 +28,15 @@
2828

2929
"frameworks": {
3030
"dnx451": {},
31-
"dnxcore50": {}
31+
"netstandardapp1.5": {
32+
"imports": [
33+
"dnxcore50",
34+
"portable-net451+win8"
35+
],
36+
"dependencies": {
37+
"NETStandard.Library": "1.5.0-*"
38+
}
39+
}
3240
},
3341

3442
"exclude": [

0 commit comments

Comments
 (0)