Skip to content

Commit b03c152

Browse files
committed
RC2 Update
1 parent 2eee5bb commit b03c152

18 files changed

+13363
-11447
lines changed

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Auto detect text files and perform LF normalization
2+
3+
* text=auto

Build.ps1

+10-92
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,21 @@
1-
function Install-Dnvm
2-
{
3-
& where.exe dnvm 2>&1 | Out-Null
4-
if(($LASTEXITCODE -ne 0) -Or ((Test-Path Env:\APPVEYOR) -eq $true))
5-
{
6-
Write-Host "DNVM not found"
7-
&{$Branch='dev';iex ((New-Object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
8-
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-
}
18-
}
19-
}
20-
21-
function Get-DnxVersion
22-
{
23-
$globalJson = Join-Path $PSScriptRoot "global.json"
24-
$jsonData = Get-Content -Path $globalJson -Raw | ConvertFrom-JSON
25-
return $jsonData.sdk.version
26-
}
27-
28-
function Restore-Packages
29-
{
30-
param([string] $DirectoryName)
31-
& dnu restore ("""" + $DirectoryName + """")
32-
}
33-
34-
function Build-Projects
35-
{
36-
param([string] $DirectoryName)
37-
& dnu build ("""" + $DirectoryName + """") --configuration Release --out .\artifacts\testbin; if($LASTEXITCODE -ne 0) { exit 1 }
38-
& dnu pack ("""" + $DirectoryName + """") --configuration Release --out .\artifacts\packages; if($LASTEXITCODE -ne 0) { exit 1 }
39-
}
40-
41-
function Build-TestProjects
42-
{
43-
param([string] $DirectoryName)
44-
& dnu build ("""" + $DirectoryName + """") --configuration Release --out .\artifacts\testbin; if($LASTEXITCODE -ne 0) { exit 1 }
45-
}
46-
47-
function Test-Projects
48-
{
49-
param([string] $DirectoryName)
50-
& dnx -p ("""" + $DirectoryName + """") test; if($LASTEXITCODE -ne 0) { exit 2 }
51-
}
52-
53-
function Remove-PathVariable
54-
{
55-
param([string] $VariableToRemove)
56-
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
57-
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
58-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
59-
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
60-
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
61-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
62-
}
63-
641
Push-Location $PSScriptRoot
652

66-
$dnxVersion = Get-DnxVersion
67-
68-
# Clean
693
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
704

71-
# Remove the installed DNVM from the path and force use of
72-
# per-user DNVM (which we can upgrade as needed without admin permissions)
73-
Remove-PathVariable "*Program Files\Microsoft DNX\DNVM*"
74-
75-
# Make sure per-user DNVM is installed
76-
Install-Dnvm
77-
78-
# Install DNX
79-
dnvm install $dnxVersion -r CoreCLR -NoNative
80-
dnvm install $dnxVersion -r CLR -NoNative
81-
dnvm use $dnxVersion -r CLR
5+
& dotnet restore
826

83-
# Package restore
84-
Get-ChildItem -Path . -Filter *.xproj -Recurse | ForEach-Object { Restore-Packages $_.DirectoryName }
7+
$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
858

86-
# Set build number
87-
$env:DNX_BUILD_VERSION = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
88-
Write-Host "Build number: " $env:DNX_BUILD_VERSION
9+
Push-Location src/Serilog.Settings.Configuration
8910

90-
# Build/package
91-
Get-ChildItem -Path .\src -Filter *.xproj -Recurse | ForEach-Object { Build-Projects $_.DirectoryName }
92-
Get-ChildItem -Path .\test -Filter *.xproj -Recurse | ForEach-Object { Build-TestProjects $_.DirectoryName }
11+
& dotnet pack -c Release -o ..\..\.\artifacts --version-suffix=$revision
12+
if($LASTEXITCODE -ne 0) { exit 1 }
9313

94-
# Test
95-
Get-ChildItem -Path .\test -Filter *.xproj -Recurse | ForEach-Object { Test-Projects $_.DirectoryName }
96-
97-
# Switch to Core CLR
98-
dnvm use $dnxVersion -r CoreCLR
14+
Pop-Location
15+
Push-Location test/Serilog.Settings.Configuration.Tests
9916

100-
# Test again
101-
Get-ChildItem -Path .\test -Filter *.xproj -Recurse | ForEach-Object { Test-Projects $_.DirectoryName }
17+
& dotnet test -c Release
18+
if($LASTEXITCODE -ne 0) { exit 2 }
10219

10320
Pop-Location
21+
Pop-Location

README.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Serilog.Settings.Configuration [![Build status](https://ci.appveyor.com/api/projects/status/r2bgfimd9ocr61px/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-settings-configuration/branch/master)
22

3-
A Serilog settings provider that reads from Microsoft.Extensions.Configuration, i.e. .NET Core's `appsettings.json` file.
3+
A Serilog settings provider that reads from _Microsoft.Extensions.Configuration_, .NET Core's `appsettings.json` file.
44

55
Configuration is read from the `Serilog` section.
66

@@ -51,4 +51,16 @@ The `WriteTo` and `Enrich` sections support the same syntax, for example the fol
5151

5252
Or alternatively, the long-form (`"Name":` ...) sytax from the first example can be used when arguments need to be supplied.
5353

54-
(This package implements a convention using `ILibraryManager` to find any package with `Serilog` anywhere in the name and pulls configuration methods from it, so the `Using` example above is redundant.)
54+
(This package implements a convention using `DependencyContext` to find any package with `Serilog` anywhere in the name and pulls configuration methods from it, so the `Using` example above is redundant.)
55+
56+
### .NET 4.x
57+
58+
To use this package in .NET 4.x applications, add `preserveCompilationContext` to `buildOptions` in _project.json_.
59+
60+
```json
61+
"net4.6": {
62+
"buildOptions": {
63+
"preserveCompilationContext": true
64+
}
65+
},
66+
```

appveyor.yml

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
version: '{build}'
2+
image: Visual Studio 2015
3+
configuration: Release
4+
install:
5+
- ps: mkdir -Force ".\build\" | Out-Null
6+
- ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1"
7+
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli"
8+
- ps: '& .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.0-preview2-002823'
9+
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
210
build_script:
3-
- ps: ./Build.ps1 -customLogger "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
11+
- ps: ./Build.ps1
12+
test: off
413
artifacts:
5-
- path: artifacts\packages\Release\Serilog.Settings.Configuration.*.nupkg
14+
- path: artifacts/Serilog.*.nupkg
615
deploy:
716
- provider: NuGet
817
api_key:
918
secure: nvZ/z+pMS91b3kG4DgfES5AcmwwGoBYQxr9kp4XiJHj25SAlgdIxFx++1N0lFH2x
1019
skip_symbols: true
1120
on:
12-
branch: /^(master|dev)$/
13-
21+
branch: /^(dev|master)$/
22+

global.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{
1+
{
22
"projects": [ "src", "test" ],
33
"sdk": {
4-
"version": "1.0.0-rc1-update1"
4+
"version": "1.0.0-preview1-002702"
55
}
66
}

sample/Sample/Program.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.Extensions.Configuration;
22
using Serilog;
3+
using System.IO;
34

45
namespace Sample
56
{
@@ -8,6 +9,7 @@ public class Program
89
public static void Main(string[] args)
910
{
1011
var configuration = new ConfigurationBuilder()
12+
.SetBasePath(Directory.GetCurrentDirectory())
1113
.AddJsonFile("appsettings.json")
1214
.Build();
1315

sample/Sample/Sample.xproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
<PropertyGroup Label="Globals">
1010
<ProjectGuid>a00e5e32-54f9-401a-bba1-2f6fcb6366cd</ProjectGuid>
1111
<RootNamespace>Sample</RootNamespace>
12-
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
13-
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
12+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
13+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
1414
</PropertyGroup>
1515

1616
<PropertyGroup>
1717
<SchemaVersion>2.0</SchemaVersion>
1818
</PropertyGroup>
19-
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
19+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
2020
</Project>

sample/Sample/appsettings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"Name": "File",
99
"Args": {
1010
"path": "%TEMP%\\Logs\\serilog-configuration-sample.txt",
11-
"outputTemplate": "{Timestamp:o} [{Level}] ({Application}/{MachineName}/{ThreadId}) {Message}{NewLine}{Exception}"
11+
"outputTemplate": "{Timestamp:o} [{Level,3:u}] ({Application}/{MachineName}/{ThreadId}) {Message}{NewLine}{Exception}"
1212
}
1313
}
1414
],

sample/Sample/project.json

+22-24
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,35 @@
22
"version": "1.0.0-*",
33
"description": "Sample Console Application",
44
"authors": [ "nblumhardt" ],
5-
"tags": [ "" ],
6-
"projectUrl": "",
7-
"licenseUrl": "",
8-
9-
"compilationOptions": {
5+
"buildOptions": {
106
"emitEntryPoint": true
117
},
128

139
"dependencies": {
14-
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
15-
"Serilog.Settings.Configuration": "",
16-
"Serilog.Sinks.Literate": "2.0.0-beta-21",
17-
"Serilog.Sinks.File": "2.0.0-beta-507",
18-
"Serilog.Enrichers.Environment": "2.0.0-beta-507",
19-
"Serilog.Enrichers.Thread": "2.0.0-beta-507"
20-
},
21-
22-
"commands": {
23-
"Sample": "Sample"
10+
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
11+
"Serilog.Settings.Configuration": {"target": "project"},
12+
"Serilog.Sinks.Literate": "2.0.0-rc-25",
13+
"Serilog.Sinks.File": "2.0.0-rc-706",
14+
"Serilog.Enrichers.Environment": "2.0.0-rc-708",
15+
"Serilog.Enrichers.Thread": "2.0.0-rc-712"
2416
},
25-
2617
"frameworks": {
27-
"dnx451": { },
28-
"dnxcore50": {
29-
"dependencies": {
30-
"Microsoft.CSharp": "4.0.1-beta-23516",
31-
"System.Collections": "4.0.11-beta-23516",
32-
"System.Console": "4.0.0-beta-23516",
33-
"System.Linq": "4.0.1-beta-23516",
34-
"System.Threading": "4.0.11-beta-23516"
18+
"net4.6": {
19+
"buildOptions": {
20+
"preserveCompilationContext": true
3521
}
22+
},
23+
"netcoreapp1.0": {
24+
"dependencies": {
25+
"Microsoft.NETCore.App": {
26+
"type": "platform",
27+
"version": "1.0.0-rc2-3002702"
28+
}
29+
},
30+
"imports": [
31+
"dnxcore50",
32+
"portable-net45+win8"
33+
]
3634
}
3735
}
3836
}

0 commit comments

Comments
 (0)