You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--no-restore broken since 4.6.5, preventing RestoreLockedMode #646
If <RestoreLockedMode>true</RestoreLockedMode> is used in csproj/Directory.Build.props then in 4.6.4 you needed to use --no-restore to prevent a restore so another explicit restore with --force-evaluate can be used afterwards. Since 4.6.5 a restore is performed even with the --no-restore, making it incompatible with the property as the restore fails.
Tested and confirmed issue in both 4.6.5 & 4.6.7. Issue not present in 4.6.4.
Not exactly the same error, but dotnet outdated -u -n -f no longer finds any new updates after version 4.6.4, at least not for me.
I tried adding the -pre flag, but then I got an exception ('auto' should be the default). I also tried with --pre-release auto but encountered the same exception.
Downgrading from 4.6.7 version by version, I finally managed to get it working for me with 4.6.4.
In conclusion, something vital has changed after version 4.6.4.
Same here. The behavior of dotnet outdated changed on our CI agents. Starting from version 4.6.5 RestoreLockedMode = true is not respected - packages.lock.json is generated - which prevents our automation from publishing app.
Reacted by Karol Pawlowski, doterik and Adam Trepka
From version 4.6.5, there is a parameter --runtime. If we do not set it, it causes MSBuild to get the /p:RuntimeIdentifiers= parameter, which overwrites our settings.
The missing value of the --runtime parameter should not set an empty value for the /p:RuntimeIdentifiers parameter in MSBuild
I may be missing something, but from the above I'd say that the RestoreLockedMode is just a collateral here. As mentioned by adamtrepka above, the p:RuntimeIdentifiers is currently always added to the restore, with an empty value if none was provided. This will overwrite the RuntimeIdentifiers set e.g. in project files or Directory.Build.props (and similar) with an empty value.
The most important fix would be just adding this parameter conditionally. Another idea I've just had is to pass p:RestoreLockedMode=true - this will mean that running dotnet-outdated (without -u) on projects with lock files won't change the lock file (the parameter doesn't have impact on projects without lock files) - which actually sounds expected.
Activity
doterik commentedon Feb 26, 2025
Not exactly the same error, but
dotnet outdated -u -n -fno longer finds any new updates after version 4.6.4, at least not for me.I tried adding the
-preflag, but then I got an exception ('auto' should be the default). I also tried with--pre-release autobut encountered the same exception.Downgrading from 4.6.7 version by version, I finally managed to get it working for me with 4.6.4.
In conclusion, something vital has changed after version 4.6.4.
darthkurak commentedon Feb 27, 2025
Same here. The behavior of dotnet outdated changed on our CI agents. Starting from version 4.6.5 RestoreLockedMode = true is not respected - packages.lock.json is generated - which prevents our automation from publishing app.
adamtrepka commentedon Feb 27, 2025
From version
4.6.5, there is a parameter--runtime. If we do not set it, it causes MSBuild to get the/p:RuntimeIdentifiers=parameter, which overwrites our settings.The missing value of the
--runtimeparameter should not set an empty value for the/p:RuntimeIdentifiersparameter in MSBuilddotnet-outdated/src/DotNetOutdated.Core/Services/DependencyGraphService.cs
Line 31 in 0259f6c
amis92 commentedon Feb 27, 2025
I'd like to add that
RestoreLockedModedoesn't seem to be an actual root issue.The
restoreis and has always been called to gather the dependency graph:dotnet-outdated/src/DotNetOutdated.Core/Services/DependencyGraphService.cs
Lines 25 to 31 in 0259f6c
There's no path that doesn't invoke this method. The
--no-restoreoption is only used for Update operations (-u|--upgrade):dotnet-outdated/src/DotNetOutdated/Program.cs
Lines 296 to 297 in 0259f6c
I may be missing something, but from the above I'd say that the
RestoreLockedModeis just a collateral here. As mentioned by adamtrepka above, thep:RuntimeIdentifiersis currently always added to therestore, with an empty value if none was provided. This will overwrite theRuntimeIdentifiersset e.g. in project files or Directory.Build.props (and similar) with an empty value.The most important fix would be just adding this parameter conditionally. Another idea I've just had is to pass
p:RestoreLockedMode=true- this will mean that runningdotnet-outdated(without-u) on projects with lock files won't change the lock file (the parameter doesn't have impact on projects without lock files) - which actually sounds expected.sowa705 commentedon Feb 27, 2025
#658 This PR should fix this issue
doterik commentedon Feb 28, 2025
@sowa705 & @slang25,
Does this PR also fix that flags without a value, i.e. omitting default values, also work?
As mentioned in my earlier comment.
Otherwise, remove the default value from all flags.
slang25 commentedon Feb 28, 2025
@doterik do you have a repro I can test this with?
sowa705 commentedon Mar 4, 2025
@slang25 Hi, would it be possible to release a new version now that the fix is merged? I can try to help if you need anything done before 4.6.8