AvaloniaUI / avalonia-dotnet-templates

Avalonia Templates for `dotnet new`
MIT License
489 stars 84 forks source link

Use Directory.Packages.props for package management #264

Open stevemonaco opened 1 month ago

stevemonaco commented 1 month ago

Is your feature request related to a problem? Please describe.

$AvaloniaVersion can't be upgraded outside of manual editing (AFAIK) whereas Directory.Packages.props can be updated in IDE and is more intended for centralized package management.

Describe the solution you'd like

Create and use Directory.Packages.props for centralized package versioning. Remove explicit Version attributes from PackageReference in csproj.

Describe alternatives you've considered

Keep the existing $AvaloniaVersion. This may be required so that we can create new Avalonia projects in existing .NET solutions? Other .NET project templates don't seem to use this newer feature yet either.

Additional context

"Manage NuGet Packages for Solution" works in VS. Will need to check/verify support in Rider, VS Code, and dotnet CLI. Project templates seem to have already dropped built-in .NET Framework support, so that's less of an issue.

There may be some learning curve issues across the user base with Directory.Packages.props as I'm not sure how well-known the feature is. Avalonia itself still doesn't use it. See this project as an example.

maxkatz6 commented 1 month ago

It works in Rider fine, as well as CLI. While I don't see reasons not to add it to our templates (at least as an option, enabled by default).

Centralized package management can be really annoying at times. Especially when you have multiple nuget sources (you need to manually map packages to them https://learn.microsoft.com/en-us/nuget/consume-packages/package-source-mapping). And when you have submodules, you better use VersionOverride always together with normal Version in shared projects. But neither of this is really a blocker for tempaltes.