Skip to content

Add better support for legacy project formats - #538

Merged
slang25 merged 2 commits into
dotnet-outdated:masterfrom
FXZFun:master_support_non_sdk_style
Apr 8, 2024
Merged

slang25 merged 2 commits into
dotnet-outdated:masterfrom
FXZFun:master_support_non_sdk_style

Conversation

@FXZFun

@FXZFun FXZFun commented Mar 28, 2024 •

Copy link
Copy Markdown
Contributor

Support older project file formats by removing the package before updating so duplicate references are not included.

The reason for this PR is that with legacy style csproj files, the dotnet add command will add a duplicate package reference instead of incrementing the version number. This is a known issue with NuGet and is not going to be resolved.

In order to continue using the tool to update packages in legacy projects, the workaround is to remove the package before updating the version. I have tested this change and am currently using a built-from-source version with this fix included so I can update legacy projects.

This PR is a more robust version of #242 with better project style detection and based off the most recent code changes.

Fixes #503, #242

Note: the Program.cs diff isn't comparing nicely in GitHub, but displays fine in Visual Studio

 - Add check for project style (sdk/legacy)
 - Remove package before upgrade for legacy projects
Comment thread src/DotNetOutdated/Program.cs Resolved

@slang25 slang25 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great work @FXZFun, thanks for this fix

@slang25

slang25 commented Apr 8, 2024

Copy link
Copy Markdown
Member

I'll get a new version out at some point tomorrow

@slang25
slang25 merged commit 08bcd9a into dotnet-outdated:master Apr 8, 2024
@FXZFun

FXZFun commented Apr 9, 2024

Copy link
Copy Markdown
Contributor Author

Sounds good, thank you!

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.

PackageReference duplication

2 participants