Skip to content
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

Update to lts 31 #17

Closed
wants to merge 9 commits into from
22 changes: 11 additions & 11 deletions Build.ps1
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
echo "build: Build started"
Write-Output "build: Build started"

Push-Location $PSScriptRoot

if(Test-Path .\artifacts) {
echo "build: Cleaning .\artifacts"
Write-Output "build: Cleaning .\artifacts"
Remove-Item .\artifacts -Force -Recurse
}

& dotnet restore --no-cache

$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL];
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$null -ne $env:APPVEYOR_REPO_BRANCH];
$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$null -ne $env:APPVEYOR_BUILD_NUMBER];
$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"]

echo "build: Version suffix is $suffix"
Write-Output "build: Version suffix is $suffix"

foreach ($src in ls src/*) {
foreach ($src in Get-ChildItem "src/*") {
Push-Location $src

echo "build: Packaging project in $src"
Write-Output "build: Packaging project in $src"

if($suffix) {
& dotnet pack -c Release --include-source -o ..\..\artifacts --version-suffix=$suffix
Expand All @@ -31,21 +31,21 @@ foreach ($src in ls src/*) {
Pop-Location
}

foreach ($test in ls test/*.PerformanceTests) {
foreach ($test in Get-ChildItem "test/*.PerformanceTests") {
Push-Location $test

echo "build: Building performance test project in $test"
Write-Output "build: Building performance test project in $test"

& dotnet build -c Release
if($LASTEXITCODE -ne 0) { exit 2 }

Pop-Location
}

foreach ($test in ls test/*.Tests) {
foreach ($test in Get-ChildItem "test/*.Tests") {
Push-Location $test

echo "build: Testing project in $test"
Write-Output "build: Testing project in $test"

& dotnet test -c Release
if($LASTEXITCODE -ne 0) { exit 3 }
Expand Down
11 changes: 11 additions & 0 deletions Setup.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$ErrorActionPreference = "Stop"

$RequiredDotnetVersion = $(Get-Content ./global.json | convertfrom-json).sdk.version

mkdir "./build"

Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./build/installcli.ps1"
& ./build/installcli.ps1 -InstallDir "$pwd/.dotnetcli" -NoPath -Version $RequiredDotnetVersion
if ($LASTEXITCODE) { exit 1 }

$env:Path = "$pwd/.dotnetcli;$env:Path"
4 changes: 3 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
version: '{build}'
skip_tags: true
image: Visual Studio 2017
image: Visual Studio 2019
configuration: Release
test: off
install:
- ps: ./Setup.ps1
build_script:
- ps: ./Build.ps1
artifacts:
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "2.2.105"
"version": "3.1.101"
}
}
}
22 changes: 15 additions & 7 deletions samples/SimpleServiceSample/SimpleServiceSample.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<Content Include="appsettings.json" CopyToOutputDirectory="PreserveNewest" />
<Content Include="appsettings.Development.json" CopyToOutputDirectory="PreserveNewest" DependentUpon="appsettings.json" />
Expand All @@ -12,13 +13,20 @@
<ProjectReference Include="..\..\src\Serilog.Extensions.Hosting\Serilog.Extensions.Hosting.csproj" />
</ItemGroup>

<PropertyGroup>
<LatestVersion>[*, 9999.0)</LatestVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog.Sinks.Console" Version="$(LatestVersion)" />
<PackageReference Include="Serilog.Settings.Configuration" Version="$(LatestVersion)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.4" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.*" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.*" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.*" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.*" />
</ItemGroup>

</Project>
26 changes: 19 additions & 7 deletions src/Serilog.Extensions.Hosting/Serilog.Extensions.Hosting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>Serilog support for .NET Core logging in hosted services</Description>
<VersionPrefix>3.0.1</VersionPrefix>
<Authors>Microsoft;Serilog Contributors</Authors>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Serilog.Extensions.Hosting</AssemblyName>
Expand All @@ -13,21 +13,33 @@
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>Serilog.Extensions.Hosting</PackageId>
<PackageTags>serilog;aspnet;aspnetcore;hosting</PackageTags>
<PackageIcon>serilog-extension-nuget.png</PackageIcon>
<PackageIconUrl>http://serilog.net/images/serilog-extension-nuget.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/serilog/serilog-extensions-hosting</PackageProjectUrl>
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<RepositoryUrl>https://github.com/serilog/serilog-extensions-hosting</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<RootNamespace>Serilog</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.8.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.1.0" />
<None Include="images/serilog-extension-nuget.png" Pack="true" PackagePath="/" />
</ItemGroup>

<PropertyGroup>
<LatestVersion>[*, 9999.0)</LatestVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="$(LatestVersion)" />
<PackageReference Include="Serilog.Extensions.Logging" Version="$(LatestVersion)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.1.*" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.*" />
Comment on lines +40 to +42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these packages are targeted to netstandard2.0. No need to multitargeting <TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that's what was all about my remarks in the comment ;)
That the solution i would prefer too

but that also means that people using AspNetCore 2.x won't resolved this assembly anymore and need to pin it to the current version.

Can you validate that you are ok with it ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but that also means that people using AspNetCore 2.x won't resolved this assembly anymore and need to pin it to the current version.

I don't understand.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the Metapackage used for AspNetCore 2.x :
https://www.nuget.org/packages/Microsoft.AspNetCore.App

Open the dependency list, it's built by dependending on Microsoft.Extension.xxxxx 2.x
So if this nuget stays netstandard2.0 (As it should, and as you suggest too), and now depends on Microsoft.Extension.xxxxx 3.x, then not sure what's going to happen.

Again the solution for user still using AspNetCore 2.x would just be to pin this dependency, that's all

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is, in essence, we are talking about two incompatible versions of the package for the same netstandard2.0 platform? And they are incompatible because of their dependencies, which changed the major version. Right?

Then this is really some problem. But you should keep in mind that nothing prevents using the new version of this package with 3.1 dependencies in applications that do not use AspNetCore at all. New 3.1 libs are just upgraded libs but still target to netstandard2.0

I would say that AspNetCore 2.x users were initially limited by the ability to evolve into new versions of libraries due to restrictions introduced by the authors of this metapackage.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is, in essence, we are talking about two incompatible versions of the package for the same netstandard2.0 platform? And they are incompatible because of their dependencies, which changed the major version. Right?

This is basically a Major version change yes, so in order to be ... up to date, people needs to update :D
I always find it funny to say but that basically it :

  • people using up to date aspnetcore would just get this lib up to date
  • people not updating their own app would just pin this lib, that's all

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is, in any case, we should not retarget the package to netcoreapp3.1. Right?

Copy link
Author

@tebeco tebeco Jan 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the decision is

  • to use "SemVer" / "just update" and "consumer needing OLD version of Microsoft (i mean still using 2.x) have to pin this dependency" => then yes
  • To let both aspnetcore 2.x and 3.x consumer => there was never a solution since packaged existed ... so the targetframework here is an opportunity that would only fix it for NetCoreApp3.1 (AspNetCore 3.1 / UWP / WinForm / Wpf / Console using Netcoreapp3.1).

Remember that .Net 5 is goign to be a big game changer for that ;)
As we speak Mono is being merge in dotnet/runtime ;)

Copy link
Author

@tebeco tebeco Jan 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again i insist on the fact that consumer that keeps using aspnetcore 2.x have already pinned their own system, so to my eyes, they would also just pin their dependencies

So yes i'm in favor of target netstandard2.0, and move to PackageReference Microsoft.Extensions.xxxx 3.x
But that's not my decision to take

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's listen to @nblumhardt opinion.

</ItemGroup>

</Project>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<AssemblyName>Serilog.Extensions.Hosting.Tests</AssemblyName>
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
Expand All @@ -14,11 +14,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit" Version="2.4.1" />
</ItemGroup>

Expand Down