From a2014e32c042fcadbb57a68868c9b2e6d570bd15 Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Thu, 2 Apr 2015 12:10:01 -0700 Subject: [PATCH] Clean up samples so they work with current tooling. --- samples/HelloWorld/Program.cs | 17 ----------------- .../HelloWorld/Properties/launchSettings.json | 9 +++++++++ samples/HelloWorld/project.json | 3 +++ .../Properties/launchSettings.json | 9 +++++++++ samples/HotAddSample/Startup.cs | 11 +++++++---- samples/HotAddSample/project.json | 12 ++---------- .../Properties/launchSettings.json | 9 +++++++++ samples/SelfHostServer/SelfHostServer.xproj | 3 +-- samples/SelfHostServer/Startup.cs | 18 ------------------ samples/SelfHostServer/project.json | 1 - samples/TestClient/Program.cs | 17 ----------------- 11 files changed, 40 insertions(+), 69 deletions(-) create mode 100644 samples/HelloWorld/Properties/launchSettings.json create mode 100644 samples/HotAddSample/Properties/launchSettings.json create mode 100644 samples/SelfHostServer/Properties/launchSettings.json diff --git a/samples/HelloWorld/Program.cs b/samples/HelloWorld/Program.cs index e693458753..eb57deedfc 100644 --- a/samples/HelloWorld/Program.cs +++ b/samples/HelloWorld/Program.cs @@ -1,20 +1,3 @@ -// Copyright (c) Microsoft Open Technologies, Inc. -// All Rights Reserved -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR -// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING -// WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF -// TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR -// NON-INFRINGEMENT. -// See the Apache 2 License for the specific language governing -// permissions and limitations under the License. - using System; using System.Net.WebSockets; using System.Text; diff --git a/samples/HelloWorld/Properties/launchSettings.json b/samples/HelloWorld/Properties/launchSettings.json new file mode 100644 index 0000000000..6161971048 --- /dev/null +++ b/samples/HelloWorld/Properties/launchSettings.json @@ -0,0 +1,9 @@ +{ + "profiles": { + "sample": { + "commandName": "sample", + "launchBrowser": true, + "launchUrl": "http://localhost:8080" + } + } +} \ No newline at end of file diff --git a/samples/HelloWorld/project.json b/samples/HelloWorld/project.json index a6fcd0a9bd..940c50ed47 100644 --- a/samples/HelloWorld/project.json +++ b/samples/HelloWorld/project.json @@ -2,6 +2,9 @@ "dependencies": { "Microsoft.Net.Http.Server": "1.0.0-*" }, + "commands": { + "sample": "HelloWorld" + }, "frameworks": { "dnx451": { }, "dnxcore50": { diff --git a/samples/HotAddSample/Properties/launchSettings.json b/samples/HotAddSample/Properties/launchSettings.json new file mode 100644 index 0000000000..62f539fadd --- /dev/null +++ b/samples/HotAddSample/Properties/launchSettings.json @@ -0,0 +1,9 @@ +{ + "profiles": { + "web": { + "commandName": "web", + "launchBrowser": true, + "launchUrl": "http://localhost:12345" + } + } +} \ No newline at end of file diff --git a/samples/HotAddSample/Startup.cs b/samples/HotAddSample/Startup.cs index 2092308438..e1424665a4 100644 --- a/samples/HotAddSample/Startup.cs +++ b/samples/HotAddSample/Startup.cs @@ -2,6 +2,7 @@ using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.AspNet.Server.WebListener; +using Microsoft.Framework.Logging; namespace HotAddSample { @@ -10,8 +11,10 @@ namespace HotAddSample // will be reset before the end of the request. public class Startup { - public void Configure(IApplicationBuilder app) + public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory) { + loggerfactory.AddConsole(LogLevel.Information); + var server = (ServerInformation)app.Server; var listener = server.Listener; listener.UrlPrefixes.Add("http://localhost:12346/pathBase/"); @@ -34,7 +37,7 @@ namespace HotAddSample await context.Response.WriteAsync("Error adding: " + toAdd + "
"); await context.Response.WriteAsync(ex.ToString().Replace(Environment.NewLine, "
")); } - await context.Response.WriteAsync("
back"); + await context.Response.WriteAsync("
back"); await context.Response.WriteAsync(""); return; } @@ -58,7 +61,7 @@ namespace HotAddSample { await context.Response.WriteAsync("Not found: " + toRemove); } - await context.Response.WriteAsync("
back"); + await context.Response.WriteAsync("
back"); await context.Response.WriteAsync(""); return; } @@ -75,7 +78,7 @@ namespace HotAddSample await context.Response.WriteAsync("" + prefix + " (remove)
"); } - await context.Response.WriteAsync("
"); + await context.Response.WriteAsync(""); await context.Response.WriteAsync(""); await context.Response.WriteAsync(""); await context.Response.WriteAsync("
"); diff --git a/samples/HotAddSample/project.json b/samples/HotAddSample/project.json index 9958bf45fb..cfc1678585 100644 --- a/samples/HotAddSample/project.json +++ b/samples/HotAddSample/project.json @@ -1,17 +1,9 @@ { - "webroot": "wwwroot", "version": "1.0.0-*", - "exclude": [ - "wwwroot" - ], - "publishExclude": [ - "**.kproj", - "**.user", - "**.vspscc" - ], "dependencies": { "Microsoft.AspNet.Hosting": "1.0.0-*", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*" + "Microsoft.AspNet.Server.WebListener": "1.0.0-*", + "Microsoft.Framework.Logging.Console": "1.0.0-*" }, "commands": { "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:12345" diff --git a/samples/SelfHostServer/Properties/launchSettings.json b/samples/SelfHostServer/Properties/launchSettings.json new file mode 100644 index 0000000000..bca9b1f442 --- /dev/null +++ b/samples/SelfHostServer/Properties/launchSettings.json @@ -0,0 +1,9 @@ +{ + "profiles": { + "web": { + "commandName": "web", + "launchBrowser": true, + "launchUrl": "http://localhost:8080" + } + } +} \ No newline at end of file diff --git a/samples/SelfHostServer/SelfHostServer.xproj b/samples/SelfHostServer/SelfHostServer.xproj index e67781baec..a744f48383 100644 --- a/samples/SelfHostServer/SelfHostServer.xproj +++ b/samples/SelfHostServer/SelfHostServer.xproj @@ -12,7 +12,6 @@ 2.0 - 59517 - + \ No newline at end of file diff --git a/samples/SelfHostServer/Startup.cs b/samples/SelfHostServer/Startup.cs index 1597e5628b..ce7464d85f 100644 --- a/samples/SelfHostServer/Startup.cs +++ b/samples/SelfHostServer/Startup.cs @@ -1,20 +1,3 @@ -// Copyright (c) Microsoft Open Technologies, Inc. -// All Rights Reserved -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR -// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING -// WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF -// TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR -// NON-INFRINGEMENT. -// See the Apache 2 License for the specific language governing -// permissions and limitations under the License. - using System; using System.Net.WebSockets; using System.Text; @@ -23,7 +6,6 @@ using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.AspNet.Server.WebListener; using Microsoft.Framework.Logging; -using Microsoft.Framework.Logging.Console; using Microsoft.Net.Http.Server; namespace SelfHostServer diff --git a/samples/SelfHostServer/project.json b/samples/SelfHostServer/project.json index e393059098..d8a3b0a190 100644 --- a/samples/SelfHostServer/project.json +++ b/samples/SelfHostServer/project.json @@ -1,5 +1,4 @@ { - "webroot": "wwwroot", "dependencies": { "Microsoft.AspNet.Hosting": "1.0.0-*", "Microsoft.AspNet.Server.WebListener": "1.0.0-*", diff --git a/samples/TestClient/Program.cs b/samples/TestClient/Program.cs index 166bb64767..a85e2fc5c4 100644 --- a/samples/TestClient/Program.cs +++ b/samples/TestClient/Program.cs @@ -1,20 +1,3 @@ -// Copyright (c) Microsoft Open Technologies, Inc. -// All Rights Reserved -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR -// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING -// WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF -// TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR -// NON-INFRINGEMENT. -// See the Apache 2 License for the specific language governing -// permissions and limitations under the License. - using System; using System.Net; using System.Net.Http;