Skip to content

Conversation

@janbiehl
Copy link
Contributor

When using centralized package management via Directory.Packages.props files builds are failing when referencing projects generated by the plugin.

To prevent builds from failing the generated projects should opt out from centralized package management. This could either be done via my implemented solution (see changes) or via Directory.Packages.props file that opts out directly inside the generated project.

I don't expect any side effects for applications that are not using centralized package management. But for applications that do use it, it is a nice addition.

Current behavior is that builds are failing when a solution uses centralized package management via Directory.Packages.props files. To prevent this behaviour we are opting out of that centralice package management for generated projects.
@doron050
Copy link
Collaborator

doron050 commented Nov 1, 2025

Hi @janbiehl, thanks for sharing this with us, This looks like a good default!

However, I would like to handle the case where someone does want to manage packages via Directory.Packages.props and wants the generated csproj to have <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> and the PackageReference to be generated without a Versionattribute.
meaning I want to add support for ManagePackageVersionsCentrally via plugin options.

Do you think this is something you can take on yourself? In this PR? You should have enough examples in the repo on how to create such option and how to conditionally render the csproj based on the option.

If not, please open a ticket for this, and we will implement it for the next version :)

- New Option 'useCentralPackageManagement'
- Deactive package management by default
@janbiehl
Copy link
Contributor Author

janbiehl commented Nov 2, 2025

Hey, I implemented the solution as I understood you. I chose not to activate Central Project Management as the default setting.

I also added some unit tests, but I see that some checks are failing. What exactly do I need to do to get the checks to turn green? It's not intuitive to me. Do i have to copy things manually around, or is there a command to get that right?

@doron050
Copy link
Collaborator

doron050 commented Nov 3, 2025

Hey, I implemented the solution as I understood you. I chose not to activate Central Project Management as the default setting.

I also added some unit tests, but I see that some checks are failing. What exactly do I need to do to get the checks to turn green? It's not intuitive to me. Do i have to copy things manually around, or is there a command to get that right?

Hi @janbiehl , great work!

For the fixes
Make sure you have SQLC installed and run:

make sqlc-generate

then
run this to fix all linting:

dotnet format --exclude GeneratedProtobuf --exclude examples

also, please document the added option here - docs/03_Usage.md under the options table

then push everything 🥇 🥇 🥇

- Fix formatting issues in CsprojGen and unit tests
- Regenerate all examples with useCentralPackageManagement option
- Add dotnet-format target to Makefile
- Update documentation for the new useCentralPackageManagement option
@doron050
Copy link
Collaborator

doron050 commented Nov 3, 2025

HI, @janbiehl try to update from our main branch and regenerate and push :)

Copy link
Collaborator

@doron050 doron050 left a comment

Choose a reason for hiding this comment

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

amazing!

./scripts/generate_protobuf.sh
./scripts/generate_protobuf.sh

dotnet-format:
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is fine, but if you install the pre-commit this is done for you.

@doron050 doron050 merged commit acd05d4 into DaredevilOSS:main Nov 11, 2025
6 checks passed
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.

3 participants