Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build break after VS updates .NET SDK and rebuild without restore #40228

Open
KirillOsenkov opened this issue Apr 16, 2024 · 8 comments
Open
Labels
Area-NetSDK untriaged Request triage from a team member
Milestone

Comments

@KirillOsenkov
Copy link
Member

VS updated .NET SDK from 6.0.28 to 6.0.29, and a build (without clean or restore) started failing with:

C:\Program Files\dotnet\sdk\6.0.420\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(358,5): error MSB4018: The "ResolveTargetingPackAssets" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\6.0.28\data\FrameworkList.xml'.
File name: 'C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\6.0.28\data\FrameworkList.xml'
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
   at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy)
   at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   at System.Xml.XmlTextReaderImpl.FinishInitUriString()
   at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
   at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings)
   at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
   at System.Xml.Linq.XDocument.Load(String uri)
   at Microsoft.NET.Build.Tasks.ResolveTargetingPackAssets.AddItemsFromFrameworkList(FrameworkListDefinition definition, IBuildEngine4 buildEngine4, List`1 referenceItems, List`1 analyzerItems)
   at Microsoft.NET.Build.Tasks.ResolveTargetingPackAssets.Resolve(StronglyTypedInputs inputs, IBuildEngine4 buildEngine)
   at Microsoft.NET.Build.Tasks.ResolveTargetingPackAssets.ExecuteCore()
   at Microsoft.NET.Build.Tasks.TaskBase.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [Q:\Repos\foo\foo.csproj]

This is difficult to investigate, I wish we had better diagnostics for this case.

Binlog available upon request.

@KirillOsenkov
Copy link
Member Author

msbuild10019.binlog

@KirillOsenkov
Copy link
Member Author

This is because building with SDK 6.0.420, which has LatestRuntimeFrameworkVersion="6.0.28", whereas on disk we have C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.29

@KirillOsenkov
Copy link
Member Author

@dsplaisted any thoughts? It seems that the Microsoft.NetCore.App.Ref has updated to 6.0.29 (there are still some leftover empty folders on disk in 6.0.28), the SDK available is 6.0.420. How can it be?

@rainersigwald rainersigwald transferred this issue from dotnet/msbuild Apr 16, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Apr 16, 2024
@dsplaisted
Copy link
Member

@joeloff @marcpopMSFT Any thoughts here? It sounds like the ASP.NET targeting pack (and maybe all of the targeting packs) got updated to 6.0.29 (and 6.0.28 was removed), but the .NET SDK was not updated to 6.0.421.

I think there are some install logs you can gather that could help @joeloff investigate.

@joeloff
Copy link
Member

joeloff commented Apr 18, 2024

I'm following up offline

@KirillOsenkov
Copy link
Member Author

Regardless of the potential installer bug, this shouldn't crash, but instead emit a nice error:

You're using SDK '6.0.420', and it specifies the LatestRuntimeFrameworkVersion='6.0.28', however the '6.0.28' targeting pack couldn't be found in 'C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\6.0.28'. It's likely that you need to install the latest version of the .NET SDK or update your Visual Studio.

@joeloff
Copy link
Member

joeloff commented Apr 18, 2024

Based on the logs, the previous version of VS installed the 6.0 runtime component, which includes targeting packs. Those got removed as part of updating VS since the new VS version carried the 6.0.29 copies. I see logs for installing 6.0.421, but they all indicate that the install was cancelled and not completed.

I don't see any event logs that show that 6.0.420 was installed or removed.

Any chance you used the zip files to install 6.0.420 under Program Files?

@KirillOsenkov
Copy link
Member Author

unlikely, we may have a script that pulls down the SDK but it would just use the installer I think

@marcpopMSFT marcpopMSFT added this to the Discussion milestone Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

4 participants