Skip to content

Commit 06ce922

Browse files
committed
Migrating from RC1 to RC2
1 parent afc0dd1 commit 06ce922

22 files changed

+300
-650
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ node_modules
2828
*.sln.ide
2929
project.lock.json
3030
.vs/
31+
.dotnet/
3132
*.dat
3233
Logs/

build.ps1

Lines changed: 49 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,82 @@
11
########################
2-
# FUNCTIONS
2+
# THE BUILD!
33
########################
4-
function Install-Dnvm
5-
{
6-
& where.exe dnvm 2>&1 | Out-Null
7-
if(($LASTEXITCODE -ne 0) -Or ((Test-Path Env:\APPVEYOR) -eq $true))
8-
{
9-
Write-Host "DNVM not found"
10-
&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
11-
12-
# Normally this happens automatically during install but AppVeyor has
13-
# an issue where you may need to manually re-run setup from within this process.
14-
if($env:DNX_HOME -eq $NULL)
15-
{
16-
Write-Host "Initial DNVM environment setup failed; running manual setup"
17-
$tempDnvmPath = Join-Path $env:TEMP "dnvminstall"
18-
$dnvmSetupCmdPath = Join-Path $tempDnvmPath "dnvm.ps1"
19-
& $dnvmSetupCmdPath setup
20-
}
21-
}
22-
}
4+
Push-Location $PSScriptRoot
235

24-
function Get-DnxVersion
6+
function Invoke-DotNetBuild
257
{
26-
$globalJson = join-path $PSScriptRoot "global.json"
27-
$jsonData = Get-Content -Path $globalJson -Raw | ConvertFrom-JSON
28-
return $jsonData.sdk.version
8+
[cmdletbinding()]
9+
param([string] $DirectoryName)
10+
& dotnet build ("""" + $DirectoryName + """") -c Release; if($LASTEXITCODE -ne 0) { exit 1 }
2911
}
3012

31-
function Restore-Packages
13+
function Invoke-Tests
3214
{
33-
param([string] $DirectoryName)
34-
& dnu restore ("""" + $DirectoryName + """")
15+
[cmdletbinding()]
16+
param([string] $DirectoryName)
17+
& dotnet test ("""" + $DirectoryName + """") -c Release; if($LASTEXITCODE -ne 0) { exit 1 }
3518
}
3619

37-
function Build-Project
20+
function Invoke-DotNetPack
3821
{
39-
param([string] $DirectoryName)
40-
& dnu build ("""" + $DirectoryName + """") --configuration Release; if($LASTEXITCODE -ne 0) { exit 1 }
22+
[cmdletbinding()]
23+
param([string] $DirectoryName)
24+
& dotnet pack ("""" + $DirectoryName + """") -c Release -o .\artifacts\packages; if($LASTEXITCODE -ne 0) { exit 1 }
4125
}
4226

43-
function Package-Project
27+
function Remove-PathVariable
4428
{
45-
param([string] $DirectoryName)
46-
& dnu pack ("""" + $DirectoryName + """") --configuration Release --out .\artifacts\packages; if($LASTEXITCODE -ne 0) { exit 1 }
29+
[cmdletbinding()]
30+
param([string] $VariableToRemove)
31+
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
32+
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
33+
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
34+
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
35+
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
36+
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
4737
}
4838

49-
function Publish-TestProject
39+
# Prepare the dotnet CLI folder
40+
$env:DOTNET_INSTALL_DIR="$(Convert-Path "$PSScriptRoot")\.dotnet\win7-x64"
41+
if (!(Test-Path $env:DOTNET_INSTALL_DIR))
5042
{
51-
param([string] $DirectoryName, [int]$Index)
52-
53-
# Publish to a numbered/indexed folder rather than the full test project name
54-
# because the package paths get long and start exceeding OS limitations.
55-
& dnu publish ("""" + $DirectoryName + """") --configuration Release --no-source --out .\artifacts\tests\$Index; if($LASTEXITCODE -ne 0) { exit 2 }
43+
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
5644
}
5745

58-
function Invoke-Tests
46+
# Download the dotnet CLI install script
47+
if (!(Test-Path .\dotnet\install.ps1))
5948
{
60-
Get-ChildItem .\artifacts\tests -Filter test.cmd -Recurse | ForEach-Object { & $_.FullName; if($LASTEXITCODE -ne 0) { exit 3 } }
49+
Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1" -OutFile ".\.dotnet\dotnet-install.ps1"
6150
}
6251

63-
function Remove-PathVariable
64-
{
65-
param([string] $VariableToRemove)
66-
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
67-
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
68-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
69-
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
70-
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
71-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
72-
}
52+
# Run the dotnet CLI install
53+
& .\.dotnet\dotnet-install.ps1
7354

74-
########################
75-
# THE BUILD!
76-
########################
77-
78-
Push-Location $PSScriptRoot
55+
# Add the dotnet folder path to the process. This gets skipped
56+
# by Install-DotNetCli if it's already installed.
57+
Remove-PathVariable $env:DOTNET_INSTALL_DIR
58+
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
7959

80-
$dnxVersion = Get-DnxVersion
60+
# Set build number
61+
$env:DOTNET_BUILD_VERSION = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1}[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
62+
Write-Host "Build number:" $env:DOTNET_BUILD_VERSION
8163

8264
# Clean
83-
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
84-
85-
# Remove the installed DNVM from the path and force use of
86-
# per-user DNVM (which we can upgrade as needed without admin permissions)
87-
Remove-PathVariable "*Program Files\Microsoft DNX\DNVM*"
88-
Install-Dnvm
89-
90-
# Install DNX
91-
dnvm update-self
92-
dnvm upgrade
93-
94-
# Make sure these versions of DNX (for now) are installed
95-
dnvm install $dnxVersion -r clr -a x86 -NoNative
96-
dnvm install $dnxVersion -r clr -a x64 -NoNative
97-
dnvm install $dnxVersion -r coreclr -a x86 -NoNative
98-
dnvm install $dnxVersion -r coreclr -a x64 -NoNative
99-
dnvm use $dnxVersion -r clr
100-
dnvm list
101-
npm cache clean
102-
dnu restore
65+
if(Test-Path .\artifacts)
66+
{
67+
Remove-Item .\artifacts -Force -Recurse
68+
}
10369

10470
# Package restore
105-
Get-ChildItem -Path . -Filter *.xproj -Recurse | ForEach-Object { dnu restore ("""" + $_.DirectoryName + """") }
106-
107-
# Set build number
108-
$env:DNX_BUILD_VERSION = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1}[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
109-
Write-Host "Build number:" $env:DNX_BUILD_VERSION
71+
& dotnet restore
11072

11173
# Build/package
112-
Get-ChildItem -Path .\src -Filter *.xproj -Recurse | ForEach-Object { Package-Project $_.DirectoryName }
113-
# Get-ChildItem -Path .\samples -Filter *.xproj -Recurse | ForEach-Object { Build-Project $_.DirectoryName }
114-
115-
# Publish tests so we can test without recompiling
116-
Get-ChildItem -Path .\test -Filter *.xproj -Recurse | ForEach-Object -Begin { $TestIndex = 0 } -Process { Publish-TestProject -DirectoryName $_.DirectoryName -Index $TestIndex; $TestIndex++; }
74+
Get-ChildItem -Path .\src -Filter *.xproj -Recurse | ForEach-Object { Invoke-DotNetPack $_.DirectoryName }
75+
Get-ChildItem -Path .\samples -Filter *.xproj -Recurse | ForEach-Object { Invoke-DotNetBuild $_.DirectoryName }
11776

118-
# Test under CLR
119-
# Invoke-Tests
77+
# Test
78+
# Get-ChildItem -Path .\tests -Filter *.xproj -Recurse | ForEach-Object { Invoke-Tests $_.DirectoryName }
12079

121-
# Switch to Core CLR
122-
#dnvm use $dnxVersion -r CoreCLR
80+
Pop-Location
12381

124-
# Test under Core CLR
125-
#Invoke-Tests
12682

127-
Pop-Location

global.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
{
2-
"projects": [ "src", "test" ],
3-
"sdk": {
4-
"version": "1.0.0-rc1-final"
5-
}
2+
"projects": [ "src", "samples" ]
63
}

makefile.shade

Lines changed: 0 additions & 9 deletions
This file was deleted.

samples/LoggingReflectInsight/Console.ReflectInsightSample/Console.ReflectInsightSample.xproj

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@
44
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
55
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
66
</PropertyGroup>
7-
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
7+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
88
<PropertyGroup Label="Globals">
99
<ProjectGuid>77b97056-6afc-4450-93ae-9da1664c5ffb</ProjectGuid>
1010
<RootNamespace>Console.ReflectInsightSample</RootNamespace>
11-
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
12-
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
11+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
12+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
13+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
1314
</PropertyGroup>
14-
<PropertyGroup>
15-
<SchemaVersion>2.0</SchemaVersion>
16-
<TypeScriptCompileBlocked>True</TypeScriptCompileBlocked>
17-
</PropertyGroup>
18-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'" />
1915
<ItemGroup>
2016
<Content Include="..\..\..\header\AspNet.Plus.licenseheader">
2117
<Link>AspNet.Plus.licenseheader</Link>
2218
</Content>
2319
</ItemGroup>
24-
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
20+
<PropertyGroup>
21+
<SchemaVersion>2.0</SchemaVersion>
22+
</PropertyGroup>
23+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
2524
</Project>

samples/LoggingReflectInsight/Console.ReflectInsightSample/Program.cs

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using AspNet.Plus.Logging.ReflectInsight;
66
using Microsoft.Extensions.Logging;
77
using System;
8-
using System.Collections.Generic;
98

109
namespace Console.ReflectInsightSample
1110
{
@@ -19,47 +18,30 @@ public class Program
1918
/// <param name="args">The arguments.</param>
2019
public static void Main(string[] args)
2120
{
22-
var loggerFactory = new LoggerFactory();
23-
loggerFactory.MinimumLevel = LogLevel.Debug;
21+
var loggerFactory = new LoggerFactory();
2422
loggerFactory.AddReflectInsight();
2523

2624
var logger = loggerFactory.CreateLogger<Program>();
25+
var exception = new Exception("Some exception");
2726

28-
var exception = new Exception("Some Exception...");
29-
var logValues = new Dictionary<string, object>();
30-
logValues["key1"] = "value1";
31-
logValues["key2"] = "value2";
32-
logValues["key3"] = new { Name = "John", Age = 100 };
27+
logger.LogDebug("LogDebug with some args: {0}, {2}", 1, 2);
28+
logger.LogTrace("LogTrace with some args: {0}, {2}", 1, 2);
3329

34-
logger.LogDebug("LogDebug");
35-
logger.LogDebug("LogDebug", exception);
36-
logger.LogDebug(logValues, "LogDebug", exception);
37-
logger.LogDebug(logValues, exception);
30+
logger.LogInformation("LogInformation with some args: {0}, {2}", 1, 2);
31+
logger.LogInformation(exception, "LogInformation with exception and some args: {0}, {2}", 1, 2);
32+
logger.LogInformation(exception);
3833

39-
logger.LogVerbose("LogVerbose");
40-
logger.LogVerbose("LogVerbose", exception);
41-
logger.LogVerbose(logValues, "LogVerbose", exception);
42-
logger.LogVerbose(logValues, exception);
34+
logger.LogWarning("LogWarning with some args: {0}, {2}", 1, 2);
35+
logger.LogWarning(exception, "LogWarning with exception and some args: {0}, {2}", 1, 2); ;
36+
logger.LogWarning(exception);
4337

44-
logger.LogInformation("LogInformation");
45-
logger.LogInformation("LogInformation", exception);
46-
logger.LogInformation(logValues, "LogInformation", exception);
47-
logger.LogInformation(logValues, exception);
48-
49-
logger.LogWarning("LogWarning");
50-
logger.LogWarning("LogWarning", exception);
51-
logger.LogWarning(logValues, "LogWarning", exception);
52-
logger.LogWarning(logValues, exception);
53-
54-
logger.LogError("LogError");
55-
logger.LogError("LogError", exception);
56-
logger.LogError(logValues, "LogError", exception);
57-
logger.LogError(logValues, exception);
38+
logger.LogError("LogError with some args: {0}, {2}", 1, 2);
39+
logger.LogError(exception, "LogError with exception and some args: {0}, {2}", 1, 2);
40+
logger.LogError(exception);
5841

59-
logger.LogCritical("LogCritical");
60-
logger.LogCritical("LogCritical", exception);
61-
logger.LogCritical(logValues, "LogCritical", exception);
62-
logger.LogCritical(logValues, exception);
42+
logger.LogCritical("LogCritical with some args: {0}, {2}", 1, 2);
43+
logger.LogCritical(exception, "LogCritical with exception and some args: {0}, {2}", 1, 2);
44+
logger.LogCritical(exception);
6345

6446
System.Console.WriteLine("Press any key to continue...");
6547
System.Console.ReadKey();

samples/LoggingReflectInsight/Console.ReflectInsightSample/Properties/launchSettings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
{
22
"version": "1.0.0-*",
3+
"buildOptions": {
4+
"emitEntryPoint": true
5+
},
36

47
"dependencies": {
5-
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
8+
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
69
"AspNet.Plus.Logging.ReflectInsight": "1.0.0-*"
710
},
811

9-
"commands": {
10-
"Console.ReflectInsightSample": "Console.ReflectInsightSample"
11-
},
12-
1312
"frameworks": {
14-
"dnx451": { }
15-
}
13+
"net451": { }
14+
}
1615
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// ASP.NET.Plus
2+
// Copyright (c) 2016 ZoneMatrix Inc.
3+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
4+
5+
using Microsoft.AspNetCore.Builder;
6+
using Microsoft.AspNetCore.Hosting;
7+
using System.IO;
8+
9+
namespace WebApi.ReflectInsightSample
10+
{
11+
/// <summary>
12+
///
13+
/// </summary>
14+
public class Program
15+
{
16+
/// <summary>
17+
/// Mains the specified arguments.
18+
/// </summary>
19+
/// <param name="args">The arguments.</param>
20+
public static void Main(string[] args)
21+
{
22+
var host = new WebHostBuilder()
23+
.UseKestrel()
24+
.UseContentRoot(Directory.GetCurrentDirectory())
25+
.UseIISIntegration()
26+
.UseStartup<Startup>()
27+
.Build();
28+
29+
host.Run();
30+
}
31+
}
32+
}

samples/LoggingReflectInsight/WebApi.ReflectInsightSample/Properties/launchSettings.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@
1010
"profiles": {
1111
"IIS Express": {
1212
"commandName": "IISExpress",
13+
"launchBrowser": true,
1314
"launchUrl": "api/values",
1415
"environmentVariables": {
15-
"Hosting:Environment": "Development"
16+
"ASPNETCORE_ENVIRONMENT": "Development"
1617
}
1718
},
18-
"web": {
19-
"commandName": "web",
19+
"WebApplication1": {
20+
"commandName": "Project",
21+
"launchBrowser": true,
22+
"launchUrl": "http://localhost:56312/api/values",
2023
"environmentVariables": {
21-
"Hosting:Environment": "Development"
24+
"ASPNETCORE_ENVIRONMENT": "Development"
2225
}
2326
}
2427
}
25-
}
28+
}

0 commit comments

Comments
 (0)