Start Debugging

Tag: csharp

300 posts · Page 1 of 30

Migrate a .NET solution to Central Package Management with Directory.Packages.props
Move every package version out of your csproj files into one Directory.Packages.props. Covers a generator script that reconciles conflicting versions with real semver ordering, the before/after dependency-graph diff that proves what moved, NU1008/NU1010/NU1013/NU1507, transitive pinning, GlobalPackageReference, VersionOverride, and why a nested Directory.Packages.props silently shadows the root one.
How to render a heading whose level (h1-h6) is chosen at runtime in a Blazor component
Blazor has no syntax for a variable tag name, and DynamicComponent only renders component types. Override BuildRenderTree and call builder.OpenElement(0, $"h{level}"). Covers attribute splatting, why the tag name must be clamped before it reaches the DOM, why changing the level rips the element out of the DOM even with @key, and an auto-levelling variant built on a cascading value.
Next