jsakamoto / Toolbelt.Blazor.HeadElement

Head element support (change the document title, "meta" elements such as OGP, and "link" elements) for Blazor apps.
https://demo-blazor-headelement.azurewebsites.net/
Mozilla Public License 2.0
159 stars 11 forks source link

.NET 5.0 support #9

Closed SteveSandersonMS closed 3 years ago

SteveSandersonMS commented 4 years ago

Starting with .NET 5 RC1, there's a binary-breaking change in RenderTreeFrame that will affect this library because of how it uses the internal RenderTreeFrame APIs. For this library to work with .NET 5 RC1 and later, you'll need to recompile. And because you're using the Microsoft.AspNetCore.Components.RenderTree.* APIs directly you'll have to multitarget netstandard2.0 and net5.0 if you want to retain compatibility with both.

I think this line here would need to be changed to:

<TargetFrameworks>netstandard2.0;net5.0</TargetFrameworks>

... and then instead of depending purely on Microsoft.AspNetCore.Components.Web 3.0.0 directly, you'll need to depend on either the 3.x or 5.x versions depending on target framework. For example, replace this line here with something like:

<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.0.0" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.0-rc.1.*" Condition="'$(TargetFramework)' != 'netstandard2.0'" />
jsakamoto commented 4 years ago

@SteveSandersonMS Thank you for your reporting!

And, I appreciate your very kind comment. 👍

Because of your comment in this thread, I could reproduce the problem, and I could fix it at commit 090df430 in the net5.0 branch in this repository.

Finally, I published the latest fixed version of the HeadElement NuGet package.

Again, thank you for your contribution!

SteveSandersonMS commented 4 years ago

Also thanks to you @jsakamoto for producing this package!