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 #165

Merged
merged 7 commits into from
Feb 19, 2020
Merged

Update to lts 31 #165

merged 7 commits into from
Feb 19, 2020

Conversation

tebeco
Copy link
Contributor

@tebeco tebeco commented Jan 18, 2020

This PR intention is to update it to netcoreapp3.1 as it is LTS.
As of today, when serilog-aspnetcore is used in project targeting netcoreapp3.1, it "leaks" few transitive dependencies Microsoft.AspNetCore.xxx and Microsoft.Extensions.xxx version 2.x.y.

  • Update dependencies from 2.0.x to 2.1.* (Wildcard to get the latest patch available at build time)
  • As AspNetCore 3.1 is NOT netstandard2.0/2.1 but only netcoreapp3.1, i cross targetted to both
    • netcoreapp3.1 for AspNetCore3.1 (LTS)
    • netstandard2.0 for AspNetCore2.1 (Also LTS)
  • As AspNetCore 3.1 is LTS, i changed the Sample TargetFramework from netcoreapp3.0 to netcoreapp3.1
  • I've set MsBuild Condition on the TargetFramework because
    • AspNetCore2.x is build with direct dependencies on Msft.Extensions 2.x
    • AspNetCore2.x is build with direct dependencies on Msft.Extensions 3.x
      This means the dependencies version need to follow this
  • I change AppVeyor image to Vs 2019 (because netcoreapp is supposed to requires vs2019 but not sure it's needed here are running dotnet-install.ps1 -Channel 3.1 would just install the latest 3.1 SDK
  • I removed all powershell warning from the linter (general idea is to never use alias, as it could leads to missunderstand or error, eg : rm -rf the -f is for -Filter and not --force)
  • added serilog-extension-nuget.png to the repo and PackageIcon as the current PackageIconUrl is is deprecated for recent SDK (see https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#packageiconurl)

@tebeco
Copy link
Contributor Author

tebeco commented Jan 18, 2020

I did not checked if some of the Serilog dependencies could be updated here to be fair :

<ItemGroup>
    <PackageReference Include="Serilog" Version="2.8.0" />
    <PackageReference Include="Serilog.Extensions.Hosting" Version="3.0.0" />
    <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
    <PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
    <PackageReference Include="Serilog.Sinks.Debug" Version="1.0.1" />
    <PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
    <PackageReference Include="Serilog.Formatting.Compact" Version="1.0.0" />
</ItemGroup>

but i can take a look

If you'd like to avoid manual check for the future, there's a very easy way using nuget to acheive "Get latest stable version", that could be used only for serilog dependencies here :

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

  <ItemGroup>
    <PackageReference Include="Serilog" Version="$(LatestVersion)" />
    <PackageReference Include="Serilog.Extensions.Hosting" Version="$(LatestVersion)" />
    <PackageReference Include="Serilog.Sinks.Console" Version="$(LatestVersion)" />
    <PackageReference Include="Serilog.Sinks.File" Version="$(LatestVersion)" />
    <PackageReference Include="Serilog.Sinks.Debug" Version="$(LatestVersion)" />
    <PackageReference Include="Serilog.Settings.Configuration" Version="$(LatestVersion)" />
    <PackageReference Include="Serilog.Formatting.Compact" Version="$(LatestVersion)" />
  </ItemGroup>

@tebeco
Copy link
Contributor Author

tebeco commented Jan 18, 2020

as you can see here :
image

  • Serilog.Extension.Hosting need to same update because of Microsoft.Extensions.Hosting.Abstractions (2.1.0)
  • Serilog.Settings.Configuration for Microsoft.Extensions.Options.ConfigurationExtensions (2.0.0) and Microsoft.Extensions.DependencyModel (2.0.4)

Build.ps1 Outdated
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];
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for changing the order of the arguments?

Copy link
Contributor 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.

it's a warning from the linter too, shipped within the Powershell extensions (msft powershell team)

i don't have the underlying reason for this one.
my personal guess would be that it applies the same principle as some unit test lib : expected/constants on the left operand.

but it's just a guess

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor 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.

i can totally revert it ;)
less warning, less "eye catchy squiggle" ^^
like "always try to enable WarnAsError"

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn’t matter to me.

@tebeco
Copy link
Contributor Author

tebeco commented Jan 18, 2020

FYI : currently updating the 2 other serilog repository that leak transitive from 2.x and i will really need a decision from serilog maintainer
more detail to come in these PR

@andrewlock
Copy link

I previously suggested multi-targeting to 3.x with @nblumhardt in serilog/serilog-extensions-logging#155 but we concluded there's actually no reason to do so, and it makes tooling etc more complicated.

I discussed the issues recently in a blog post: https://andrewlock.net/converting-a-netstandard-2-library-to-netcore-3/#libraries-that-depend-on-microsoft-extensions-nuget-packages

The conclusion was that there's no need to upgrade this library, serilog-extensions-hosting, or serilog-extensions-logging! The other commits that remove deprecated properties etc would definitely be handy though 🙂

@tebeco
Copy link
Contributor Author

tebeco commented Jan 20, 2020

EDIT : previous answers was weird ;)

As you said, serilog-extensions-logging only consume Microsoft.Extensions.Logging
https://github.com/serilog/serilog-extensions-logging/blob/dev/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj#L32
So you are right serilog-extensions-logging, can stay on netstandard2.0

This repo consumes a package the was previously shipped as a Nuget, and now shipped from the FrameworkReference (which is only netcoreapp3.1)
https://github.com/serilog/serilog-aspnetcore/blob/dev/src/Serilog.AspNetCore/Serilog.AspNetCore.csproj#L31

I made 2 other PR to 2 others repo that only consumed Microsoft.Extension.XXX,
I first used netcoreapp3.1 to discriminates for consumer that uses AspNetCore 2.x or AspNetCore 3.x

Few minutes before your answer here, i rolled that back to netstandard2.0 with this idea :
There's only 2 LTS version that has not reached End Of Life yet : 2.1 and 3.1
So anybody staying on 2.1 kinda is "pinning his runtime" to a specific (old/older) version already.
My point is that, pinning the runtime also means pinning dependencies compliant with that runtime.

This is done already in Serilog.Settings.Configuration, for example :
https://github.com/serilog/serilog-settings-configuration/blob/dev/src/Serilog.Settings.Configuration/Serilog.Settings.Configuration.csproj#L34

@nblumhardt
Copy link
Member

Hi @tebeco - I think we should go ahead with this change; thanks for sending the PR, and sorry about the slow turnaround at this end.

Would it be possible to remove the other build script and CSPROJ changes (latest version references etc.) from the PR, and just commit the netcoreapp3.1 targeting change? The other parts are somewhat standardized across all of the Serilog repos and any changes there will need more consideration/discussion that's separate to the issue covered by this PR.

Thanks!

@tebeco
Copy link
Contributor Author

tebeco commented Feb 12, 2020

So this means that when the nuget is released, serilog transitive will potentially points to deprecated version ?

@tebeco
Copy link
Contributor Author

tebeco commented Feb 12, 2020

As you said, you standardize few things, like the icon URL. As nuget team is actively depracting it, that's why i changed it here as it's probably going to be needed.

image

No idea why the change, but i guess that relying on an external URL for an icon can lead to issues like DNS issues / timeout / unpaid domain / overflow / crafted response / ...

@tebeco
Copy link
Contributor Author

tebeco commented Feb 12, 2020

@nblumhardt
Can you check the new history now ? Does it look like what you had in mind ?

@nblumhardt
Copy link
Member

Thanks for the follow-up @tebeco 👍

We should make the <PackageIcon> change - sorry I wasn't clear (we've updated this in many other Serilog repos already). It was changes like $(LatestVersion) that I'd prefer to hold off.

It looks like you may not have pushed your updated changes to your branch? Everything still looks the same. Cheers!

@tebeco
Copy link
Contributor Author

tebeco commented Feb 17, 2020

@nblumhardt
Sorry I pushed the wrong branch -_-
classic PEBKAC

Copy link
Member

@nblumhardt nblumhardt left a comment

Choose a reason for hiding this comment

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

Thanks! This looks great; just one minor thing regarding referenced package versions, otherwise I think we're set! 😎

src/Serilog.AspNetCore/Serilog.AspNetCore.csproj Outdated Show resolved Hide resolved
@tebeco
Copy link
Contributor Author

tebeco commented Feb 19, 2020

@nblumhardt
any thing else I could have missed ?

@tebeco
Copy link
Contributor Author

tebeco commented Feb 19, 2020

regarding all the ps1 stuff, it almost feels like you want to create a Serilog.BuildTool package just like dotnet/arcade so that all your technical scripts / images for the Icon / Copyright etc ... are all in an eng folder (engineering I guess)

so everytime you update the build process,

  • you update that lib (or dotnet tool ?)
  • pull it down per repo
  • ran it so that it update eng folder
  • you're never supposed to manually edit eng folder (like a lock file)
  • git add eng && git commit -m "update build tooling"

that way you could may a bot attempts to automatically creates PR + run the script of all organization repositories here

=> One fix to fix them all

@tebeco
Copy link
Contributor Author

tebeco commented Feb 19, 2020

(rebased / force-with-lease on dev branch)

@nblumhardt
Copy link
Member

👍 thanks! I'll bump the package version to 3.3.0 because of the dependency version updates. We'd normally consider these a breaking change, but since the package will still run on the earlier versions of those dependencies, I think we can squeeze this into a minor version bump.

@nblumhardt nblumhardt merged commit 3433261 into serilog:dev Feb 19, 2020
@tebeco
Copy link
Contributor Author

tebeco commented Feb 19, 2020

Thx a lot for your time ;)

Do you think the others repo that were not bump could cross target netstandard2.1, i understand that they do no explicitly uses ns2.1 API, but that would makes netcoreapp3.1 resolves it, so that Transtive like Msft.Ext.Logging could be resolving 3.1.2 for example.

So far nuget resolves the oldest possible match => it does not respect anymore HigestDependency Settings so sometimes it resolves Msft.Ext.Logging 2.1 at work for stacks using netcoreapp3.1

That would be a way to helps nuget resolves proper dependencies based on the TFM wihtout breaking backward compat.
Should i re-open an issue about that on these repo ?
(pinging @andrewlock as he was also involved with you in that process / discussion)

@CleverNeologism
Copy link

CleverNeologism commented Feb 19, 2020

Should the SDK in global.json also be updated to latest 3.1? Stock VS2019 install will not open this solution. It is also not the latest 3.0 version.

@tebeco
Copy link
Contributor Author

tebeco commented Feb 19, 2020

for this PR ? 3.1.102 was released last night so that may be why
image

also as you can see here i've setup proper version for packages (my brain half functions):
image

@tebeco
Copy link
Contributor Author

tebeco commented Feb 19, 2020

#172

@tebeco tebeco deleted the update-to-lts-31 branch February 19, 2020 23:16
@sungam3r
Copy link
Contributor

@CleverNeologism @tebeco Hi, can you tell me what is the point in the global.json file? When I do not have the exact sdk mentioned in global.json, then solution does not open. It’s easier for me just to delete this file so that everything works.

@tebeco
Copy link
Contributor Author

tebeco commented Feb 20, 2020

https://docs.microsoft.com/en-us/dotnet/core/tools/global-json?tabs=netcore3x

that's probably faster to link than attempting a long explanation that could potentially be wrong
in short ...
if you have trouble right now since this file points to the latest version
=> please everything you are doing and update both your sdk and visual studio
vs2019 16.4 is required for netcoreapp3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants