[singleproject] fix changing $(ApplicationDisplayVersion) inside VS #6628
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #3690
Fixes: #6626
Changing
$(ApplicationDisplayVersion)
inside Visual Studio causesbuilds to fail:
You get this error once per
TargetFramework
. Builds outside VS workfine!
dotnet build
succeeds.I was able to attach a debugger to VS, and hit a breakpoint on this
line in NuGet:
https://github.com/NuGet/NuGet.Client/blob/82630f7f8fb5114a207c295f2f9bea1bc2a6b3cf/src/NuGet.Clients/NuGet.SolutionRestoreManager/VsSolutionRestoreService.cs#L227
With a stack trace of:
This appears to be caused by an issue with NuGet inside Visual Studio:
NuGet/Home#6461
If you get a different
$(PackageVersion)
for any TF, you run intothis.
It appears we set
$(Version)
based off of$(ApplicationDisplayVersion)
in all of the mobile workloads:Android, MacCatalyst, iOS, etc. Then
$(PackageVersion)
is also basedon
$(Version)
.Except when using MAUI for net6.0-windows. To workaround this issue,
we can put the same code in
WinUI.targets
:This seems reasonable for our WinUI support in MAUI anyway, as we have
code that makes
$(ApplicationDisplayVersion)
work there.