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>
<RepositoryUrl>https://github.com/aspnet/MetaPackages</RepositoryUrl>
<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>
<!-- Pin versions to work around CLI bug -->
@ -24,7 +20,7 @@
<ItemGroup Condition="'$(TargetFrameworkIdentifier)'=='.NETFramework' AND '$(OutputType)'=='library'">
<PackageReference Include="NETStandard.Library" Version="$(NetStandardImplicitPackageVersion)" />
</ItemGroup>
<ItemGroup>
<!-- set PrivateAssets=None to ensure that all assets, including Build and Analyzer, are included in the nuspec -->
<MetaPackagePackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
@ -32,7 +28,6 @@
<MetaPackagePackageReference Include="Microsoft.AspNetCore.Routing" 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.Https" 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.Json" Version="$(AspNetCoreVersion)" PrivateAssets="None" />
@ -107,6 +102,7 @@
<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.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.Libuv" 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.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@ -13,61 +10,54 @@ namespace SampleApp
{
public static void Main(string[] args)
{
HelloWorld();
//HelloWorld();
CustomUrl();
//CustomUrl();
CustomRouter();
Router();
StartupClass(args);
//StartupClass(args);
}
private static void HelloWorld()
{
using (WebHost.Start(context => context.Response.WriteAsync("Hello, World!")))
{
//host.WaitForShutdown(); // TODO: https://github.com/aspnet/Hosting/issues/1022
Console.WriteLine("Running HelloWorld: Press any key to shutdown and start the next sample...");
Console.ReadKey();
}
var host = WebHost.Start(context => context.Response.WriteAsync("Hello, World!"));
//host.WaitForShutdown(); // TODO: This method needs to be added to Hosting
Console.WriteLine("Press any key to shutdown...");
Console.ReadKey();
}
private static void CustomUrl()
{
// Changing the listening URL
using (WebHost.Start("http://localhost:8080", context => context.Response.WriteAsync("Hello, World!")))
{
//host.WaitForShutdown(); // TODO: https://github.com/aspnet/Hosting/issues/1022
Console.WriteLine("Running CustomUrl: Press any key to shutdown and start the next sample...");
Console.ReadKey();
}
var host = WebHost.Start("http://localhost:8080", context => context.Response.WriteAsync("Hello, World!"));
//host.WaitForShutdown(); // TODO: This method needs to be added to Hosting
Console.WriteLine("Press any key to shutdown...");
Console.ReadKey();
}
private static void CustomRouter()
private static void 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("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("{greeting}/{name}", (req, res, data) => res.WriteAsync($"{data.Values["greeting"]}, {data.Values["name"]}"))
.MapGet("", (req, res, data) => res.WriteAsync($"Hello, World!"))))
{
//host.WaitForShutdown(); // TODO: https://github.com/aspnet/Hosting/issues/1022
Console.WriteLine("Running CustomRouter: Press any key to shutdown and start the next sample...");
Console.ReadKey();
}
.MapGet("", (req, res, data) => res.WriteAsync($"Hello, World!"))
);
//host.WaitForShutdown(); // TODO: This method needs to be added to Hosting
Console.WriteLine("Press any key to shutdown...");
Console.ReadKey();
}
private static void StartupClass(string[] args)
{
// Using defaults with a Startup class
using (var host = WebHost.CreateDefaultBuilder(args)
var host = WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build())
{
host.Run();
}
.Build();
host.Run();
}
}
}

View File

@ -1,10 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace SampleApp
{
@ -14,7 +16,7 @@ namespace SampleApp
{
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.Run(async (context) =>

View File

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

View File

@ -12,9 +12,9 @@
<Target Name="CollectDeps" DependsOnTargets="Restore;RunResolvePackageDependencies">
<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>
<Copy SourceFiles="@(DepsFiles)" DestinationFolder="$(DepsOutputPath)\Microsoft.NETCore.App\2.0.0\" />
</Target>
</Project>

View File

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

View File

@ -21,16 +21,16 @@ namespace Microsoft.AspNetCore
{
/// <summary>
/// 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>
/// <param name="app">A delegate that handles requests to the application.</param>
/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns>
public static IWebHost Start(RequestDelegate app) =>
Start(url: null, app: app);
Start(null, app);
/// <summary>
/// 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>
/// <param name="url">The URL the hosted application will listen on.</param>
/// <param name="app">A delegate that handles requests to the application.</param>
@ -40,16 +40,16 @@ namespace Microsoft.AspNetCore
/// <summary>
/// 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>
/// <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>
public static IWebHost Start(Action<IRouteBuilder> routeBuilder) =>
Start(url: null, routeBuilder: routeBuilder);
Start(null, routeBuilder);
/// <summary>
/// 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>
/// <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>
@ -59,22 +59,22 @@ namespace Microsoft.AspNetCore
/// <summary>
/// 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>
/// <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>
public static IWebHost StartWith(Action<IApplicationBuilder> app) =>
StartWith(url: null, app: app);
StartWith(null, app);
/// <summary>
/// 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>
/// <param name="url">The URL the hosted application will listen on.</param>
/// <param name="app">The delegate that configures the <see cref="IApplicationBuilder"/>.</param>
/// <returns>A started <see cref="IWebHost"/> that hosts the application.</returns>
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)
{
@ -115,7 +115,7 @@ namespace Microsoft.AspNetCore
/// </remarks>
/// <returns>The initialized <see cref="IWebHostBuilder"/>.</returns>
public static IWebHostBuilder CreateDefaultBuilder() =>
CreateDefaultBuilder(args: null);
CreateDefaultBuilder(null);
/// <summary>
/// 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()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((hostingContext, config) =>
.ConfigureConfiguration((hostingContext, config) =>
{
var env = hostingContext.HostingEnvironment;
@ -166,6 +166,7 @@ namespace Microsoft.AspNetCore
{
logging.AddConsole();
})
// TODO: Remove this when ANCM injects it by default
.UseIISIntegration()
.ConfigureServices(services =>
{