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
This is a regression caused by changes in MSBuildSdkResolver that were introduced in dotnet/sdk#45364. Specifically by adding 2 new properties.
This results in hitting the path that was not hit before - handling properties and items of SdkResult:
When Project is created from XmlReader and not from ProjectRootElement, it results in null ProjectRootElement during Evaluation. Which results in internal exception like InternalErrorException: MSB0001: Internal MSBuild Error: .SdkResolver.1981936763.proj unexpectedly not a rooted path here:
Changed the projet path that is created for SdkResult properties and items - if there is no ProjectRootElement then generate name like {Guid}.SdkResolver.{propertiesAndItemsHash}.proj in the current directory.
@tsvietOK you could try to copy the old MSBuildSdkResolver folder from Visual Studio 17.12 and put it in the newer Visual Studio. You can find it in your Visual Studio location (usually C:\Program Files\Microsoft Visual Studio\2022\Enterprise) {Visual Studio path}\MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver.
@tsvietOK you could try to copy the old MSBuildSdkResolver folder from Visual Studio 17.12 and put it in the newer Visual Studio. You can find it in your Visual Studio location (usually C:\Program Files\Microsoft Visual Studio\2022\Enterprise) {Visual Studio path}\MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver.
Thank you, will try. Do you have any estimates of when this fix will be released?
@tsvietOK you could try to copy the old MSBuildSdkResolver folder from Visual Studio 17.12 and put it in the newer Visual Studio. You can find it in your Visual Studio location (usually C:\Program Files\Microsoft Visual Studio\2022\Enterprise) {Visual Studio path}\MSBuild\Current\Bin\SdkResolvers\Microsoft.DotNet.MSBuildSdkResolver.
This suggestion helped, thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 #11550
Context
This is a regression caused by changes in
MSBuildSdkResolverthat were introduced in dotnet/sdk#45364. Specifically by adding 2 new properties.This results in hitting the path that was not hit before - handling properties and items of
SdkResult:msbuild/src/Build/Evaluation/Evaluator.cs
Lines 1867 to 1875 in 6aeb262
When
Projectis created fromXmlReaderand not fromProjectRootElement, it results in nullProjectRootElementduring Evaluation. Which results in internal exception likeInternalErrorException: MSB0001: Internal MSBuild Error: .SdkResolver.1981936763.proj unexpectedly not a rooted pathhere:msbuild/src/Build/Evaluation/Evaluator.cs
Line 1928 in 6aeb262
Above created project path is just
.SdkResolver.1981936763.projwith no directory. Later exception is thrown here because of it:msbuild/src/Build/Evaluation/ProjectRootElementCache.cs
Line 262 in 9e51a07
or here if you use
SimpleProjectRootElementCache:msbuild/src/Build/Evaluation/SimpleProjectRootElementCache.cs
Line 43 in 9e51a07
Changes Made
Changed the projet path that is created for
SdkResultproperties and items - if there is noProjectRootElementthen generate name like{Guid}.SdkResolver.{propertiesAndItemsHash}.projin the current directory.Testing
Added test. Tested manually as well
Notes