-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Issue Description
I downloaded source code from some hosting site, which produces a zipfile "project@commithash.zip". Extracting and building that using "dotnet build/msbuild" works fine, if it's a solution, but not if it's a solution filter.
Steps to Reproduce
- download bugtest@commithash.zip
- extract to some location such that it still contains "
@" - cd to
\bugtest@commithash\Solution - run
dotnet build Test.slnf
Expected Behavior
The project is built successfully.
Actual Behavior
D:\Projects\bugtest@commithash\Solution
❯ dotnet build Test.slnf
D:\Projects\bugtest@commithash\Solution\Test.slnf : error MSB4014:
The build stopped unexpectedly because of an internal failure.
System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Projects\bugtest%40commithash\Solution\Solution.sln'.
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, Nullable`1 unixCreateMode)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.File.OpenRead(String path)
at Microsoft.Build.Construction.SolutionFile.GetSolutionFileAndVisualStudioMajorVersions(String solutionFile, Int32& solutionVersion, Int32& visualStudioMajorVersion)
at Microsoft.Build.Execution.ProjectInstance.LoadSolutionForBuild(String projectFile, PropertyDictionary`1 globalPropertiesInstances, String toolsVersion, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext projectBuildEventContext, B
oolean isExplicitlyLoaded, IReadOnlyCollection`1 targetNames, ISdkResolverService sdkResolverService, Int32 submissionId)
at Microsoft.Build.Execution.BuildManager.LoadSolutionIntoConfiguration(BuildRequestConfiguration config, BuildRequest request)
at Microsoft.Build.Execution.BuildManager.HandleNewRequest(Int32 node, BuildRequestBlocker blocker)
at Microsoft.Build.Execution.BuildManager.<>c__DisplayClass99_0.<IssueBuildRequestForBuildSubmission>g__IssueBuildSubmissionToSchedulerImpl|1(BuildSubmission submission, Boolean allowMainThreadBuild)
Build failed with 1 error(s) in 0,0s
Analysis
Notice %40 (which is @) in the path mentioned in the error message. It seems that when resolving the path to the solution file from the slnf JSON file, a URL is constructed at some point and is not properly unescaped when converting it back to a filesystem path.
Versions & Configurations
❯ dotnet build --version
17.12.0.47303
❯ dotnet --info
.NET SDK:
Version: 9.0.100-rc.2.24474.11
Commit: 315e1305db
Workload version: 9.0.100-manifests.4872d5d5
MSBuild version: 17.12.0-preview-24473-03+fea15fbd1
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100-rc.2.24474.11\