Skip to content
This repository was archived by the owner on Jan 24, 2021. It is now read-only.

Commit a9989a6

Browse files
committed
Merge pull request #2467 from NancyFx/coreclr
Merge coreclr branch into master (attempt 2)
2 parents f8c79f5 + 301d1d0 commit a9989a6

File tree

180 files changed

+4755
-1826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+4755
-1826
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ Gemfile.lock
3131
packages/
3232
project.lock.json
3333
TestAssembly.dll
34+
.vscode/

Nancy.Next.sln

+9
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Nancy.ViewEngines.Razor.Tes
8282
EndProject
8383
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Nancy.ViewEngines.Razor.Tests.Models", "test\Nancy.ViewEngines.Razor.Tests.Models\Nancy.ViewEngines.Razor.Tests.Models.xproj", "{31FA18D3-24AD-4AB0-B297-5A2FD871989E}"
8484
EndProject
85+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{AA791E28-7914-439A-B59A-580B8D8FE95D}"
86+
EndProject
87+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Nancy.Demo.Hosting.Kestrel", "samples\Nancy.Demo.Hosting.Kestrel\Nancy.Demo.Hosting.Kestrel.xproj", "{9921E059-612B-4011-9AB6-FD30E69850A1}"
88+
EndProject
8589
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Nancy.Tests.Functional", "test\Nancy.Tests.Functional\Nancy.Tests.Functional.xproj", "{742AC687-FC9A-4534-BB50-3D91738563A7}"
8690
EndProject
8791
Global
@@ -230,6 +234,10 @@ Global
230234
{31FA18D3-24AD-4AB0-B297-5A2FD871989E}.Debug|Any CPU.Build.0 = Debug|Any CPU
231235
{31FA18D3-24AD-4AB0-B297-5A2FD871989E}.Release|Any CPU.ActiveCfg = Release|Any CPU
232236
{31FA18D3-24AD-4AB0-B297-5A2FD871989E}.Release|Any CPU.Build.0 = Release|Any CPU
237+
{9921E059-612B-4011-9AB6-FD30E69850A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
238+
{9921E059-612B-4011-9AB6-FD30E69850A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
239+
{9921E059-612B-4011-9AB6-FD30E69850A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
240+
{9921E059-612B-4011-9AB6-FD30E69850A1}.Release|Any CPU.Build.0 = Release|Any CPU
233241
{742AC687-FC9A-4534-BB50-3D91738563A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
234242
{742AC687-FC9A-4534-BB50-3D91738563A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
235243
{742AC687-FC9A-4534-BB50-3D91738563A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -274,6 +282,7 @@ Global
274282
{C46BFAA7-F471-45A6-A5AC-FCF9390408EE} = {F44224E5-8E58-4D52-A0F0-BCBA2ADC0A0B}
275283
{A24271FA-E058-42E0-BB7D-3C8C43DF4B04} = {F44224E5-8E58-4D52-A0F0-BCBA2ADC0A0B}
276284
{31FA18D3-24AD-4AB0-B297-5A2FD871989E} = {F44224E5-8E58-4D52-A0F0-BCBA2ADC0A0B}
285+
{9921E059-612B-4011-9AB6-FD30E69850A1} = {AA791E28-7914-439A-B59A-580B8D8FE95D}
277286
{742AC687-FC9A-4534-BB50-3D91738563A7} = {F44224E5-8E58-4D52-A0F0-BCBA2ADC0A0B}
278287
EndGlobalSection
279288
EndGlobal

Nancy.Next.sln.DotSettings

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Ecshtml/@EntryIndexedValue">True</s:Boolean>
3+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTypeMemberModifiers/@EntryIndexedValue">WARNING</s:String>
4+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTypeModifiers/@EntryIndexedValue">WARNING</s:String>
5+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=BuiltInTypeReferenceStyle/@EntryIndexedValue">WARNING</s:String>
6+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FBuiltInTypes/@EntryIndexedValue">WARNING</s:String>
7+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FElsewhere/@EntryIndexedValue">WARNING</s:String>
8+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FSimpleTypes/@EntryIndexedValue">WARNING</s:String>
9+
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=NancyStandard/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="NancyStandard"&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;CAN_CHANGE_TO_IMPLICIT&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;ALWAYS_IMPLICIT&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;ALWAYS_IMPLICIT&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSReorderTypeMembers&gt;True&lt;/CSReorderTypeMembers&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;/Profile&gt;</s:String>
10+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">All</s:String>
11+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue">False</s:Boolean>
12+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
13+
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_AUTO_PROPERTY/@EntryValue">1</s:Int64>
14+
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_FIELD/@EntryValue">1</s:Int64>
15+
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_INVOCABLE/@EntryValue">1</s:Int64>
16+
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_SINGLE_LINE_PROPERTY/@EntryValue">1</s:Int64>
17+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FIXED_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
18+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOR_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
19+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOREACH_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
20+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_IFELSE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
21+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_USING_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
22+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
23+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INITIALIZER_BRACES/@EntryValue">NEXT_LINE</s:String>
24+
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
25+
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
26+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/LINE_FEED_AT_FILE_END/@EntryValue">True</s:Boolean>
27+
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/REDUNDANT_THIS_QUALIFIER_STYLE/@EntryValue">ALWAYS_USE</s:String>
28+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
29+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AROUND_MULTIPLICATIVE_OP/@EntryValue">True</s:Boolean>
30+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_SIZEOF_PARENTHESES/@EntryValue">False</s:Boolean>
31+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_TYPEOF_PARENTHESES/@EntryValue">False</s:Boolean>
32+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHIN_SINGLE_LINE_ARRAY_INITIALIZER_BRACES/@EntryValue">True</s:Boolean>
33+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/STICK_COMMENT/@EntryValue">False</s:Boolean>
34+
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AddImportsToDeepestScope/@EntryValue">True</s:Boolean>
35+
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/QualifiedUsingAtNestedScope/@EntryValue">True</s:Boolean>
36+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=MethodPropertyEvent/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="" Suffix="" Style="Aa_bb" /&gt;&lt;/Policy&gt;</s:String>
37+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
38+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
39+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
40+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
41+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
42+
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String>
43+
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String>
44+
</wpf:ResourceDictionary>
45+

NuGet.config

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
<configuration>
44
<packageSources>
5+
<!-- add key="CoreCLR Xunit" value="https://www.myget.org/F/coreclr-xunit/api/v3/index.json" / -->
6+
<!-- add key="AspNet CI Feed" value="https://www.myget.org/F/aspnetcirelease/api/v3/index.json" /> -->
7+
<add key="myget.org xunit" value="https://www.myget.org/F/xunit/api/v3/index.json" />
8+
<add key="dotnet.myget.org dotnet-cli" value="https://dotnet.myget.org/F/dotnet-cli/api/v3/index.json" />
59
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
610
</packageSources>
711
</configuration>

build.ps1

+48-80
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,60 @@
1-
function Install-Dnvm
1+
function Install-Dotnet
22
{
3-
& where.exe dnvm 2>&1 | Out-Null
4-
if(($LASTEXITCODE -ne 0) -Or ((Test-Path Env:\APPVEYOR) -eq $true))
3+
& where.exe dotnet 2>&1 | Out-Null
4+
5+
if(($LASTEXITCODE -ne 0) -Or ((Test-Path Env:\APPVEYOR) -eq $true))
6+
{
7+
Write-Host "Dotnet CLI not found - downloading latest version"
8+
9+
# Prepare the dotnet CLI folder
10+
$env:DOTNET_INSTALL_DIR="$(Convert-Path "$PSScriptRoot")\.dotnet\win7-x64"
11+
if (!(Test-Path $env:DOTNET_INSTALL_DIR))
512
{
6-
Write-Host "DNVM not found"
7-
&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
13+
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
14+
}
815

9-
# Normally this happens automatically during install but AppVeyor has
10-
# an issue where you may need to manually re-run setup from within this process.
11-
if($env:DNX_HOME -eq $NULL)
12-
{
13-
Write-Host "Initial DNVM environment setup failed; running manual setup"
14-
$tempDnvmPath = Join-Path $env:TEMP "dnvminstall"
15-
$dnvmSetupCmdPath = Join-Path $tempDnvmPath "dnvm.ps1"
16-
& $dnvmSetupCmdPath setup
17-
}
16+
# Download the dotnet CLI install script
17+
if (!(Test-Path .\dotnet\install.ps1))
18+
{
19+
Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1" -OutFile ".\.dotnet\dotnet-install.ps1"
1820
}
21+
22+
# Run the dotnet CLI install
23+
& .\.dotnet\dotnet-install.ps1
24+
25+
# Add the dotnet folder path to the process. This gets skipped
26+
# by Install-DotNetCli if it's already installed.
27+
Remove-PathVariable $env:DOTNET_INSTALL_DIR
28+
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
29+
30+
}
1931
}
2032

21-
function Get-DnxVersion
33+
function Remove-PathVariable
2234
{
23-
$globalJson = join-path $PSScriptRoot "global.json"
24-
$jsonData = Get-Content -Path $globalJson -Raw | ConvertFrom-JSON
25-
return $jsonData.sdk.version
35+
[cmdletbinding()]
36+
param([string] $VariableToRemove)
37+
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
38+
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
39+
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
40+
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
41+
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
42+
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
2643
}
2744

2845
function Restore-Packages
2946
{
3047
param([string] $DirectoryName)
31-
& dnu restore --quiet ("""" + $DirectoryName + """")
32-
}
33-
34-
function Pack-Projects
35-
{
36-
param([string] $DirectoryName, [string] $Configuration)
37-
& dnu pack --quiet ("""" + $DirectoryName + """") --configuration $Configuration --out .\artifacts\packages; if($LASTEXITCODE -ne 0) { exit 2 }
48+
& dotnet restore -v Warning ("""" + $DirectoryName + """")
3849
}
3950

4051
function Test-Projects
4152
{
42-
& dnx test; if($LASTEXITCODE -ne 0) { exit 3 }
43-
}
44-
45-
function Remove-PathVariable
46-
{
47-
param([string] $VariableToRemove)
48-
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
49-
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
50-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
51-
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
52-
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
53-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
53+
& dotnet test -c Release;
54+
if($LASTEXITCODE -ne 0)
55+
{
56+
exit 3
57+
}
5458
}
5559

5660
########################
@@ -59,55 +63,19 @@ function Remove-PathVariable
5963

6064
Push-Location $PSScriptRoot
6165

62-
$dnxVersion = Get-DnxVersion
63-
64-
if (!$env:CONFIGURATION)
65-
{
66-
$env:CONFIGURATION = "Release"
67-
}
68-
69-
# Clean
70-
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
71-
72-
# Remove the installed DNVM from the path and force use of
73-
# per-user DNVM (which we can upgrade as needed without admin permissions)
74-
Remove-PathVariable "*Program Files\Microsoft DNX\DNVM*"
75-
76-
# Make sure per-user DNVM is installed
77-
Install-Dnvm
78-
79-
# Install DNX
80-
dnvm install $dnxVersion -r CoreCLR -NoNative
81-
dnvm install $dnxVersion -r CLR -NoNative
82-
83-
# Start with regular CLR
84-
dnvm use $dnxVersion -r CLR
66+
# Install Dotnet CLI
67+
Install-Dotnet
8568

8669
# Package restore
70+
Write-Host "Running package restore"
8771
Get-ChildItem -Path . -Filter *.xproj -Recurse | ForEach-Object { Restore-Packages $_.DirectoryName }
8872

89-
# Set build number
90-
$env:DNX_BUILD_VERSION = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
91-
Write-Host "Build number: " $env:DNX_BUILD_VERSION
92-
93-
# Package
94-
Get-ChildItem -Path .\src -Filter *.xproj -Recurse | ForEach-Object { Pack-Projects $_.DirectoryName $env:CONFIGURATION }
95-
96-
# Test
73+
# Tests
74+
Write-Host "Running tests"
9775
Get-ChildItem -Path .\test -Filter *.xproj -Exclude Nancy.ViewEngines.Razor.Tests.Models.xproj -Recurse | ForEach-Object {
9876
Push-Location $_.DirectoryName
99-
Test-Projects $_.DirectoryName
77+
Test-Projects
10078
Pop-Location
101-
}
102-
103-
# Switch to Core CLR
104-
#dnvm use $dnxVersion -r CoreCLR
105-
106-
# Test again
107-
# Get-ChildItem -Path .\test -Filter *Tests.xproj -Recurse | ForEach-Object {
108-
# Push-Location $_.DirectoryName
109-
# Test-Projects $_.DirectoryName
110-
# Pop-Location
111-
# }
79+
}
11280

11381
Pop-Location

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"projects": [ "src", "test", "samples" ],
33
"sdk": {
4-
"version": "1.0.0-rc1-update1"
4+
"version": "1.0.0-preview1-002702"
55
}
66
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace Nancy.Demo.Hosting.Kestrel
2+
{
3+
public class AppConfiguration
4+
{
5+
public Logging Logging { get; set; }
6+
public Smtp Smtp { get; set; }
7+
}
8+
9+
public class LogLevel
10+
{
11+
public string Default { get; set; }
12+
public string System { get; set; }
13+
public string Microsoft { get; set; }
14+
}
15+
16+
public class Logging
17+
{
18+
public bool IncludeScopes { get; set; }
19+
public LogLevel LogLevel { get; set; }
20+
}
21+
22+
public class Smtp
23+
{
24+
public string Server { get; set; }
25+
public string User { get; set; }
26+
public string Pass { get; set; }
27+
public string Port { get; set; }
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace Nancy.Demo.Hosting.Kestrel
2+
{
3+
using System;
4+
5+
public class DemoBootstrapper : DefaultNancyBootstrapper
6+
{
7+
public DemoBootstrapper()
8+
{
9+
10+
}
11+
12+
public DemoBootstrapper(AppConfiguration appConfig)
13+
{
14+
/*
15+
We could register appConfig as an instance in the container which can
16+
be injected into areas that need it or we could create our own INancyEnvironment
17+
extension and use that.
18+
*/
19+
Console.WriteLine(appConfig.Smtp.Server);
20+
Console.WriteLine(appConfig.Smtp.User);
21+
Console.WriteLine(appConfig.Logging.IncludeScopes);
22+
}
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace Nancy.Demo.Hosting.Kestrel
2+
{
3+
using System.Threading.Tasks;
4+
5+
public class HomeModule : NancyModule
6+
{
7+
public HomeModule()
8+
{
9+
Get("/", (args, ct) => Task.FromResult("Hello from Nancy running on CoreCLR"));
10+
11+
Get("/conneg/{name}", (args, token) => Task.FromResult(new Person() { Name = args.name }));
12+
}
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<PropertyGroup Label="Globals">
9+
<ProjectGuid>9921e059-612b-4011-9ab6-fd30e69850a1</ProjectGuid>
10+
<RootNamespace>Nancy.Demo.Hosting.Kestrel</RootNamespace>
11+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
12+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
13+
</PropertyGroup>
14+
<PropertyGroup>
15+
<SchemaVersion>2.0</SchemaVersion>
16+
</PropertyGroup>
17+
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
18+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Nancy.Demo.Hosting.Kestrel
2+
{
3+
public class Person
4+
{
5+
public string Name { get; set; }
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace Nancy.Demo.Hosting.Kestrel
2+
{
3+
using System.IO;
4+
using Microsoft.AspNetCore.Builder;
5+
using Microsoft.AspNetCore.Hosting;
6+
7+
public class Program
8+
{
9+
public static void Main(string[] args)
10+
{
11+
var host = new WebHostBuilder()
12+
.UseContentRoot(Directory.GetCurrentDirectory())
13+
.UseKestrel()
14+
.UseStartup<Startup>()
15+
.Build();
16+
17+
host.Run();
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)