You've already forked linux-packaging-mono
Imported Upstream version 5.20.0.180
Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
parent
0e2d47d1c8
commit
0510252385
21
external/corert/samples/WebApi/README.md
vendored
21
external/corert/samples/WebApi/README.md
vendored
@ -1,13 +1,10 @@
|
||||
# Building a WebAPI app with CoreRT
|
||||
|
||||
This document will guide you through compiling a .NET Core Web API application with CoreRT.
|
||||
CoreRT is an AOT-optimized .NET Core runtime. This document will guide you through compiling a .NET Core Web API application with CoreRT.
|
||||
|
||||
## Install the .NET Core SDK
|
||||
CoreRT is an AOT-optimized .NET Core runtime. If you're new to .NET Core make sure to visit the [official starting page](http://dotnet.github.io). It will guide you through installing pre-requisites and building your first app.
|
||||
If you're already familiar with .NET Core make sure you've [downloaded and installed the .NET Core 2 SDK](https://www.microsoft.com/net/download/core).
|
||||
_Please ensure that [pre-requisites](../prerequisites.md) are installed._
|
||||
|
||||
## Create your app
|
||||
|
||||
Open a new shell/command prompt window and run the following commands.
|
||||
```bash
|
||||
> dotnet new webapi -o myApp
|
||||
@ -51,6 +48,10 @@ services.AddMvc();
|
||||
to
|
||||
|
||||
```csharp
|
||||
var applicationPartManager = new ApplicationPartManager();
|
||||
applicationPartManager.ApplicationParts.Add(new AssemblyPart(typeof(Startup).Assembly));
|
||||
services.Add(new ServiceDescriptor(typeof(ApplicationPartManager), applicationPartManager));
|
||||
|
||||
services.AddMvcCore().AddJsonFormatters();
|
||||
```
|
||||
|
||||
@ -86,9 +87,9 @@ where path_to_rdxml_file is the location of the file on your disk.
|
||||
Under the second `<ItemGroup>` remove the line containing a reference to `Microsoft.AspNetCore.All` and substitute it with:
|
||||
|
||||
```xml
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.1.0" />
|
||||
```
|
||||
|
||||
This substitution removes unnecessary package references added by AspNetCore.All, which will remove them from your application's published files and avoid encountering unsupported features, as described in [the section above](#add-core-mvc-services)
|
||||
@ -132,12 +133,12 @@ where `<Configuration>` is your project configuration (such as Debug or Release)
|
||||
> dotnet publish -r win-x64 -c release
|
||||
```
|
||||
|
||||
Once completed, you can find the native executable in the root folder of your project under `/bin/x64/<Configuration>/netcoreapp2.0/publish/`
|
||||
Once completed, you can find the native executable in the root folder of your project under `/bin/x64/<Configuration>/netcoreapp2.1/publish/`
|
||||
|
||||
## Try it out!
|
||||
|
||||
If you are running macOS, make sure you have [libuv](https://github.com/libuv/libuv) installed, as ASP.NET is built on top of libuv. You can use [homebrew](https://brew.sh/) to get it (`brew install libuv`).
|
||||
|
||||
Navigate to `/bin/x64/<Configuration>/netcoreapp2.0/publish/` in your project folder and run the produced executable. It should display "Now listening on: http://localhost:XXXX" with XXXX being a port on your machine. Open your browser and navigate to that URL. You should see "Hello World!" displayed in your browser.
|
||||
Navigate to `/bin/x64/<Configuration>/netcoreapp2.1/publish/` in your project folder and run the produced executable. It should display "Now listening on: http://localhost:XXXX" with XXXX being a port on your machine. Open your browser and navigate to that URL. You should see "Hello World!" displayed in your browser.
|
||||
|
||||
Feel free to modify the sample application and experiment. However, keep in mind some functionality might not yet be supported in CoreRT. Let us know on the [Issues page](https://github.com/dotnet/corert/issues/).
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -13,9 +13,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Formatters.Json" Version="2.1.0" />
|
||||
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-*" />
|
||||
</ItemGroup>
|
||||
|
||||
|
6
external/corert/samples/WebApi/Startup.cs
vendored
6
external/corert/samples/WebApi/Startup.cs
vendored
@ -8,6 +8,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc.ApplicationParts;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -27,6 +28,11 @@ namespace SampleWebApi
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
// Override automatic discovery of Application parts done by MVC. It is not compatible with single file compilation.
|
||||
var applicationPartManager = new ApplicationPartManager();
|
||||
applicationPartManager.ApplicationParts.Add(new AssemblyPart(typeof(Startup).Assembly));
|
||||
services.Add(new ServiceDescriptor(typeof(ApplicationPartManager), applicationPartManager));
|
||||
|
||||
services.AddMvcCore().AddJsonFormatters();
|
||||
}
|
||||
|
||||
|
18
external/corert/samples/WebApi/rd.xml
vendored
18
external/corert/samples/WebApi/rd.xml
vendored
@ -6,13 +6,12 @@
|
||||
<Type Name="Microsoft.AspNetCore.Server.Kestrel.Core.Internal.KestrelServerOptionsSetup" Dynamic="Required All" />
|
||||
</Assembly>
|
||||
<Assembly Name="Microsoft.AspNetCore.Server.Kestrel" Dynamic="Required All"/>
|
||||
<Assembly Name="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv">
|
||||
<Type Name="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.LibuvTransportFactory" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.LibuvTransportOptions" Dynamic="Required All" />
|
||||
<Assembly Name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets">
|
||||
<Type Name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportOptions" Dynamic="Required All" />
|
||||
</Assembly>
|
||||
<Assembly Name="Microsoft.Extensions.DependencyInjection" Dynamic="Required All">
|
||||
<Type Name="Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteExpressionBuilder" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator" Dynamic="Required All" />
|
||||
</Assembly>
|
||||
@ -32,6 +31,7 @@
|
||||
<Assembly Name="Microsoft.AspNetCore.Mvc.Formatters.Json">
|
||||
<Type Name="Microsoft.AspNetCore.Mvc.Formatters.Json.Internal.MvcJsonMvcOptionsSetup" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.AspNetCore.Mvc.MvcJsonOptions" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.AspNetCore.Mvc.MvcJsonOptionsConfigureCompatibilityOptions" Dynamic="Required All" />
|
||||
</Assembly>
|
||||
<Assembly Name="Microsoft.AspNetCore.Authorization">
|
||||
<Type Name="Microsoft.AspNetCore.Authorization.DefaultAuthorizationPolicyProvider" Dynamic="Required All" />
|
||||
@ -40,8 +40,12 @@
|
||||
<Assembly Name="Microsoft.AspNetCore.Http">
|
||||
<Type Name="Microsoft.AspNetCore.Http.HttpContextFactory" Dynamic="Required All" />
|
||||
</Assembly>
|
||||
<Assembly Name="Microsoft.AspNetCore.HostFiltering">
|
||||
<Type Name="Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware" Dynamic="Required All" />
|
||||
</Assembly>
|
||||
<Assembly Name="Microsoft.AspNetCore.Hosting" Dynamic="Required All">
|
||||
<Type Name="Microsoft.AspNetCore.Hosting.Internal.ApplicationLifetime" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.AspNetCore.Hosting.Internal.StartupLoader+ConfigureServicesDelegateBuilder`1[[System.Object,System.Private.CoreLib]]" Dynamic="Required All" />
|
||||
</Assembly>
|
||||
<Assembly Name="Microsoft.Extensions.Logging.Abstractions">
|
||||
<Type Name="Microsoft.Extensions.Logging.Logger`1[[Microsoft.AspNetCore.Hosting.Internal.WebHost,Microsoft.AspNetCore.Hosting]]" Dynamic="Required All" />
|
||||
@ -49,9 +53,15 @@
|
||||
<Assembly Name="Microsoft.Extensions.Logging">
|
||||
<Type Name="Microsoft.Extensions.Logging.LoggerFactory" Dynamic="Required All" />
|
||||
</Assembly>
|
||||
<Assembly Name="Microsoft.Extensions.Logging.Configuration">
|
||||
<Type Name="Microsoft.Extensions.Logging.Configuration.LoggerProviderConfigurationFactory" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.Extensions.Logging.Configuration.LoggerProviderConfiguration`1[[Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider,Microsoft.Extensions.Logging.Console]]" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.Extensions.Logging.Configuration.LoggerProviderOptionsChangeTokenSource`2[[Microsoft.Extensions.Logging.Console.ConsoleLoggerOptions,Microsoft.Extensions.Logging.Console],[Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider,Microsoft.Extensions.Logging.Console]]" Dynamic="Required All" />
|
||||
</Assembly>
|
||||
<Assembly Name="Microsoft.Extensions.Logging.Console">
|
||||
<Type Name="Microsoft.Extensions.Logging.Console.ConsoleLoggerOptions" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider" Dynamic="Required All" />
|
||||
<Type Name="Microsoft.Extensions.Logging.Console.ConsoleLoggerOptionsSetup" Dynamic="Required All" />
|
||||
</Assembly>
|
||||
<Assembly Name="Microsoft.Extensions.Logging.Debug">
|
||||
<Type Name="Microsoft.Extensions.Logging.Debug.DebugLogger" Dynamic="Required All" />
|
||||
|
Reference in New Issue
Block a user