Revert "Update build targets and clean up"

This reverts commit 587985b497.
This commit is contained in:
Mike Harder 2017-04-20 18:46:34 -07:00
parent 587985b497
commit 992407fb35
7 changed files with 53 additions and 61 deletions

View File

@ -6,10 +6,6 @@
<Product>Microsoft ASP.NET Core</Product> <Product>Microsoft ASP.NET Core</Product>
<RepositoryUrl>https://github.com/aspnet/MetaPackages</RepositoryUrl> <RepositoryUrl>https://github.com/aspnet/MetaPackages</RepositoryUrl>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
<AssemblyOriginatorKeyFile>..\..\build\Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
<VersionSuffix Condition="'$(VersionSuffix)'!='' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix> <VersionSuffix Condition="'$(VersionSuffix)'!='' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
<!-- Pin versions to work around CLI bug --> <!-- Pin versions to work around CLI bug -->
@ -32,7 +28,6 @@
<MetaPackagePackageReference Include="Microsoft.AspNetCore.Routing" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <MetaPackagePackageReference Include="Microsoft.AspNetCore.Routing" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<MetaPackagePackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <MetaPackagePackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<MetaPackagePackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <MetaPackagePackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<MetaPackagePackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<MetaPackagePackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <MetaPackagePackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<MetaPackagePackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <MetaPackagePackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<MetaPackagePackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <MetaPackagePackageReference Include="Microsoft.Extensions.Configuration.Json" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
@ -107,6 +102,7 @@
<FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Routing.Abstractions" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Routing.Abstractions" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Server.HttpSys" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Server.HttpSys" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Core" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Core" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
<FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Session" Version="$(AspNetCoreVersion)" PrivateAssets="None" /> <FullMetaPackagePackageReference Include="Microsoft.AspNetCore.Session" Version="$(AspNetCoreVersion)" PrivateAssets="None" />

View File

@ -1,7 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. using System;
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore; using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
@ -13,61 +10,54 @@ namespace SampleApp
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
HelloWorld(); //HelloWorld();
CustomUrl(); //CustomUrl();
CustomRouter(); Router();
StartupClass(args); //StartupClass(args);
} }
private static void HelloWorld() private static void HelloWorld()
{ {
using (WebHost.Start(context => context.Response.WriteAsync("Hello, World!"))) var host = WebHost.Start(context => context.Response.WriteAsync("Hello, World!"));
{ //host.WaitForShutdown(); // TODO: This method needs to be added to Hosting
//host.WaitForShutdown(); // TODO: https://github.com/aspnet/Hosting/issues/1022 Console.WriteLine("Press any key to shutdown...");
Console.WriteLine("Running HelloWorld: Press any key to shutdown and start the next sample..."); Console.ReadKey();
Console.ReadKey();
}
} }
private static void CustomUrl() private static void CustomUrl()
{ {
// Changing the listening URL // Changing the listening URL
using (WebHost.Start("http://localhost:8080", context => context.Response.WriteAsync("Hello, World!"))) var host = WebHost.Start("http://localhost:8080", context => context.Response.WriteAsync("Hello, World!"));
{ //host.WaitForShutdown(); // TODO: This method needs to be added to Hosting
//host.WaitForShutdown(); // TODO: https://github.com/aspnet/Hosting/issues/1022 Console.WriteLine("Press any key to shutdown...");
Console.WriteLine("Running CustomUrl: Press any key to shutdown and start the next sample..."); Console.ReadKey();
Console.ReadKey();
}
} }
private static void CustomRouter() private static void Router()
{ {
// Using a router // Using a router
using (WebHost.Start(router => router var host = WebHost.Start(router => router
.MapGet("hello/{name}", (req, res, data) => res.WriteAsync($"Hello, {data.Values["name"]}")) .MapGet("hello/{name}", (req, res, data) => res.WriteAsync($"Hello, {data.Values["name"]}"))
.MapGet("goodbye/{name}", (req, res, data) => res.WriteAsync($"Goodbye, {data.Values["name"]}")) .MapGet("goodbye/{name}", (req, res, data) => res.WriteAsync($"Goodbye, {data.Values["name"]}"))
.MapGet("throw/{message?}", (req, res, data) => throw new Exception((string)data.Values["message"] ?? "Uh oh!")) .MapGet("throw/{message?}", (req, res, data) => throw new Exception((string)data.Values["message"] ?? "Uh oh!"))
.MapGet("{greeting}/{name}", (req, res, data) => res.WriteAsync($"{data.Values["greeting"]}, {data.Values["name"]}")) .MapGet("{greeting}/{name}", (req, res, data) => res.WriteAsync($"{data.Values["greeting"]}, {data.Values["name"]}"))
.MapGet("", (req, res, data) => res.WriteAsync($"Hello, World!")))) .MapGet("", (req, res, data) => res.WriteAsync($"Hello, World!"))
{ );
//host.WaitForShutdown(); // TODO: https://github.com/aspnet/Hosting/issues/1022 //host.WaitForShutdown(); // TODO: This method needs to be added to Hosting
Console.WriteLine("Running CustomRouter: Press any key to shutdown and start the next sample..."); Console.WriteLine("Press any key to shutdown...");
Console.ReadKey(); Console.ReadKey();
}
} }
private static void StartupClass(string[] args) private static void StartupClass(string[] args)
{ {
// Using defaults with a Startup class // Using defaults with a Startup class
using (var host = WebHost.CreateDefaultBuilder(args) var host = WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>() .UseStartup<Startup>()
.Build()) .Build();
{ host.Run();
host.Run();
}
} }
} }
} }

View File

@ -1,10 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved. using System;
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace SampleApp namespace SampleApp
{ {

View File

@ -7,7 +7,7 @@
<TargetFramework>netstandard1.6</TargetFramework> <TargetFramework>netstandard1.6</TargetFramework>
<PackageTags>aspnetcore</PackageTags> <PackageTags>aspnetcore</PackageTags>
<Description>Microsoft.AspNetCore.All</Description> <Description>Microsoft.AspNetCore.All</Description>
<EnableApiCheck>false</EnableApiCheck> <GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -12,7 +12,7 @@
<Target Name="CollectDeps" DependsOnTargets="Restore;RunResolvePackageDependencies"> <Target Name="CollectDeps" DependsOnTargets="Restore;RunResolvePackageDependencies">
<ItemGroup> <ItemGroup>
<DepsFiles Include="%(FileDefinitions.ResolvedPath)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(Identity)', '.*?\.HostingStartup\.deps\.json')) " /> <DepsFiles Include="%(FileDefinitions.ResolvedPath)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(Identity)', '.*?\.HostingStartup\.deps\.json')) "/>
</ItemGroup> </ItemGroup>
<Copy SourceFiles="@(DepsFiles)" DestinationFolder="$(DepsOutputPath)\Microsoft.NETCore.App\2.0.0\" /> <Copy SourceFiles="@(DepsFiles)" DestinationFolder="$(DepsOutputPath)\Microsoft.NETCore.App\2.0.0\" />

View File

@ -3,11 +3,14 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<IncludeBuildOutput>true</IncludeBuildOutput>
<TargetFramework>netstandard1.5</TargetFramework> <TargetFramework>netstandard1.5</TargetFramework>
<PackageTags>aspnetcore</PackageTags> <PackageTags>aspnetcore</PackageTags>
<Description>Microsoft.AspNetCore</Description> <Description>Microsoft.AspNetCore</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
<EnableApiCheck>false</EnableApiCheck> <AssemblyOriginatorKeyFile>..\..\build\Key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -21,16 +21,16 @@ namespace Microsoft.AspNetCore
{ {
/// <summary> /// <summary>
/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. /// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults.
/// See <see cref="CreateDefaultBuilder()"/> for details. /// See <see cref="WebHost.CreateDefaultBuilder"/> for details.
/// </summary> /// </summary>
/// <param name="app">A delegate that handles requests to the application.</param> /// <param name="app">A delegate that handles requests to the application.</param>
/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns> /// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns>
public static IWebHost Start(RequestDelegate app) => public static IWebHost Start(RequestDelegate app) =>
Start(url: null, app: app); Start(null, app);
/// <summary> /// <summary>
/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. /// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults.
/// See <see cref="CreateDefaultBuilder()"/> for details. /// See <see cref="WebHost.CreateDefaultBuilder"/> for details.
/// </summary> /// </summary>
/// <param name="url">The URL the hosted application will listen on.</param> /// <param name="url">The URL the hosted application will listen on.</param>
/// <param name="app">A delegate that handles requests to the application.</param> /// <param name="app">A delegate that handles requests to the application.</param>
@ -40,16 +40,16 @@ namespace Microsoft.AspNetCore
/// <summary> /// <summary>
/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. /// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults.
/// See <see cref="CreateDefaultBuilder()"/> for details. /// See <see cref="WebHost.CreateDefaultBuilder"/> for details.
/// </summary> /// </summary>
/// <param name="routeBuilder">A delegate that configures the router for handling requests to the application.</param> /// <param name="routeBuilder">A delegate that configures the router for handling requests to the application.</param>
/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns> /// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns>
public static IWebHost Start(Action<IRouteBuilder> routeBuilder) => public static IWebHost Start(Action<IRouteBuilder> routeBuilder) =>
Start(url: null, routeBuilder: routeBuilder); Start(null, routeBuilder);
/// <summary> /// <summary>
/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. /// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults.
/// See <see cref="CreateDefaultBuilder()"/> for details. /// See <see cref="WebHost.CreateDefaultBuilder"/> for details.
/// </summary> /// </summary>
/// <param name="url">The URL the hosted application will listen on.</param> /// <param name="url">The URL the hosted application will listen on.</param>
/// <param name="routeBuilder">A delegate that configures the router for handling requests to the application.</param> /// <param name="routeBuilder">A delegate that configures the router for handling requests to the application.</param>
@ -59,22 +59,22 @@ namespace Microsoft.AspNetCore
/// <summary> /// <summary>
/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. /// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults.
/// See <see cref="CreateDefaultBuilder()"/> for details. /// See <see cref="WebHost.CreateDefaultBuilder"/> for details.
/// </summary> /// </summary>
/// <param name="app">The delegate that configures the <see cref="IApplicationBuilder"/>.</param> /// <param name="app">A delegate that handles requests to the application.</param>
/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns> /// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns>
public static IWebHost StartWith(Action<IApplicationBuilder> app) => public static IWebHost StartWith(Action<IApplicationBuilder> app) =>
StartWith(url: null, app: app); StartWith(null, app);
/// <summary> /// <summary>
/// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults. /// Initializes and starts a new <see cref="IWebHost"/> with pre-configured defaults.
/// See <see cref="CreateDefaultBuilder()"/> for details. /// See <see cref="WebHost.CreateDefaultBuilder"/> for details.
/// </summary> /// </summary>
/// <param name="url">The URL the hosted application will listen on.</param> /// <param name="url">The URL the hosted application will listen on.</param>
/// <param name="app">The delegate that configures the <see cref="IApplicationBuilder"/>.</param> /// <param name="app">The delegate that configures the <see cref="IApplicationBuilder"/>.</param>
/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns> /// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns>
public static IWebHost StartWith(string url, Action<IApplicationBuilder> app) => public static IWebHost StartWith(string url, Action<IApplicationBuilder> app) =>
StartWith(url: url, configureServices: null, app: app); StartWith(url, null, app);
private static IWebHost StartWith(string url, Action<IServiceCollection> configureServices, Action<IApplicationBuilder> app) private static IWebHost StartWith(string url, Action<IServiceCollection> configureServices, Action<IApplicationBuilder> app)
{ {
@ -115,7 +115,7 @@ namespace Microsoft.AspNetCore
/// </remarks> /// </remarks>
/// <returns>The initialized <see cref="IWebHostBuilder"/>.</returns> /// <returns>The initialized <see cref="IWebHostBuilder"/>.</returns>
public static IWebHostBuilder CreateDefaultBuilder() => public static IWebHostBuilder CreateDefaultBuilder() =>
CreateDefaultBuilder(args: null); CreateDefaultBuilder(null);
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="WebHostBuilder"/> class with pre-configured defaults. /// Initializes a new instance of the <see cref="WebHostBuilder"/> class with pre-configured defaults.
@ -139,7 +139,7 @@ namespace Microsoft.AspNetCore
var builder = new WebHostBuilder() var builder = new WebHostBuilder()
.UseKestrel() .UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((hostingContext, config) => .ConfigureConfiguration((hostingContext, config) =>
{ {
var env = hostingContext.HostingEnvironment; var env = hostingContext.HostingEnvironment;
@ -166,6 +166,7 @@ namespace Microsoft.AspNetCore
{ {
logging.AddConsole(); logging.AddConsole();
}) })
// TODO: Remove this when ANCM injects it by default
.UseIISIntegration() .UseIISIntegration()
.ConfigureServices(services => .ConfigureServices(services =>
{ {