Skip to content

Create a prototype of Microsoft.AspNetCore.App.RefOnly #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
feed/
publish/
obj/
ref/
.dotnet/
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<_AspNetCoreAppSharedFxIsEnabled>false</_AspNetCoreAppSharedFxIsEnabled>
<RestoreSources>https://api.nuget.org/v3/index.json</RestoreSources>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Microsoft.AspNetCore.App.RefOnly</id>
<version>2.1.0</version>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<licenseUrl>https://raw.githubusercontent.com/aspnet/Home/2.0.0/LICENSE.txt</licenseUrl>
<projectUrl>https://asp.net/</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<description>Microsoft.AspNetCore.App</description>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<tags>aspnetcore</tags>
<serviceable>true</serviceable>
<repository type="git" url="https://github.com/aspnet/Universe"/>
<dependencies>
<group targetFramework=".NETCoreApp2.1">
</group>
</dependencies>
</metadata>
<files>
<file src="build\**\*" target="build" />
<file src="ref\**\*" target="ref" />
<file src="lib\**\*" target="lib" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project>
<PropertyGroup>
<MicrosoftNETPlatformLibrary>Microsoft.AspNetCore.App.RefOnly</MicrosoftNETPlatformLibrary>
</PropertyGroup>

<Target Name="EnsureTFMCompatibility" BeforeTargets="_CheckForInvalidConfigurationAndPlatform">
<Error
Text="This version of Microsoft.AspNetCore.App is only compatible with the netcoreapp2.1 target framework. Please target netcoreapp2.1 or choose a version of Microsoft.AspNetCore.App compatible with $(TargetFramework)."
Condition="'$(TargetFramework)' != 'netcoreapp2.1'"/>
</Target>
</Project>
Empty file.
42 changes: 42 additions & 0 deletions pkg/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
$ErrorActionPreference = 'stop'

mkdir -p "$PSScriptRoot/obj" -ea ignore | out-null

function Invoke-Block ([scriptblock] $_cmd) {
& $_cmd
if ((-not $?) -or ($LASTEXITCODE -ne 0)) {
throw "command failed"
}
}

$nuget = "$PSScriptRoot/obj/nuget.exe"
if (-not (Test-Path $nuget)) {
iwr -o $nuget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
}

$dotnet = "$PSScriptRoot/.dotnet/dotnet"
$dotnetInstall = "$PSScriptRoot/obj/dotnet-install.ps1"
if (-not (Test-Path $dotnetInstall)) {
iwr -o $dotnetInstall https://raw.githubusercontent.com/dotnet/cli/release/2.1.3xx/scripts/obtain/dotnet-install.ps1
}
& $dotnetInstall -installdir "$PSScriptRoot/.dotnet" -version 2.1.300
Copy-Item -Recurse "$PSScriptRoot/.dotnet/shared/Microsoft.AspNetCore.App" "$PSScriptRoot/.dotnet/shared/Microsoft.AspNetCore.App.RefOnly"
mv "$PSScriptRoot/.dotnet/shared/Microsoft.AspNetCore.App.RefOnly/2.1.0/Microsoft.AspNetCore.App.deps.json" "$PSScriptRoot/.dotnet/shared/Microsoft.AspNetCore.App.RefOnly/2.1.0/Microsoft.AspNetCore.App.RefOnly.deps.json"
mv "$PSScriptRoot/.dotnet/shared/Microsoft.AspNetCore.App.RefOnly/2.1.0/Microsoft.AspNetCore.App.runtimeconfig.json" "$PSScriptRoot/.dotnet/shared/Microsoft.AspNetCore.App.RefOnly/2.1.0/Microsoft.AspNetCore.App.RefOnly.runtimeconfig.json"
$refsPublish = "$PSScriptRoot/Microsoft.AspNetCore.App.RefOnly/ref/netcoreapp2.1"
Invoke-Block { & $dotnet publish Microsoft.AspNetCore.App.RefOnly/Microsoft.AspNetCore.App.RefOnly.csproj --output $refsPublish }
rm "$refsPublish/Microsoft.AspNetCore.App.RefOnly.dll"
rm "$refsPublish/runtimes/" -Recurse
rm "$refsPublish/*.json"
Invoke-Block { & $nuget pack "$PSScriptRoot/Microsoft.AspNetCore.App.RefOnly/Microsoft.AspNetCore.App.RefOnly.nuspec" -OutputDirectory "$PSScriptRoot/feed" }

rm $env:USERPROFILE/.nuget/packages/Microsoft.AspNetCore.App.RefOnly -Recurse -ea ignore
Invoke-Block { & $dotnet publish test/test.csproj -o "$(pwd)/publish/" }

pushd publish
try {
Invoke-Block { & $dotnet test.dll }
}
finally {
popd
}
5 changes: 5 additions & 0 deletions pkg/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "2.1.300"
}
}
24 changes: 24 additions & 0 deletions pkg/test/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace test
{
public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
}

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
}
34 changes: 34 additions & 0 deletions pkg/test/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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;

namespace test
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
}
}
12 changes: 12 additions & 0 deletions pkg/test/test.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RestoreSources>https://api.nuget.org/v3/index.json;$(MSBuildProjectDirectory)\..\feed\</RestoreSources>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App.RefOnly" Version="2.1.0" />
</ItemGroup>

</Project>