dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.21k stars 1.35k forks source link

System.IO.PathTooLongException - VS2022 #8629

Open MariusEls opened 1 year ago

MariusEls commented 1 year ago

I recently installed VS2022 and attempted to build a solution that currently builds successful in VS2019, and got the below error:

This is an unhandled exception in MSBuild -- PLEASE UPVOTE AN EXISTING ISSUE OR FILE A NEW ONE AT https://aka.ms/msbuild/unhandled. System.IO.PathTooLongException: Path: C:\xxx\xxxxxx\xxxxxxxx\xxxx\xxxxxxx\xxxxxxxxxxxxxxxxx\xxx\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\xxxxxxxx\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL exceeds the OS max path limit. The fully qualified file name must be less than 260 characters. at Microsoft.Build.Shared.FileUtilities.GetFullPath(String path) at Microsoft.Build.Shared.FileUtilities.NormalizePath(String path) at Microsoft.Build.Shared.FileUtilities.GetFullPath(String fileSpec, String currentDirectory) at Microsoft.Build.Evaluation.LazyItemEvaluator4.LazyItemList.ProcessNonWildCardItemUpdates(Dictionary2 itemsWithNoWildcards, Builder items) at Microsoft.Build.Evaluation.LazyItemEvaluator4.LazyItemList.ComputeItems(LazyItemList lazyItemList, ImmutableHashSet1 globsToIgnore) at Microsoft.Build.Evaluation.LazyItemEvaluator4.LazyItemList.GetItemData(ImmutableHashSet1 globsToIgnore) at System.Linq.Enumerable.d172.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable1 source) at System.Linq.OrderedEnumerable1.d1.MoveNext() at Microsoft.Build.Evaluation.Evaluator4.Evaluate() at Microsoft.Build.Evaluation.Evaluator4.Evaluate(IEvaluatorData4 data, Project project, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary1 environmentProperties, ILoggingService loggingService, IItemFactory2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive) at Microsoft.Build.Execution.ProjectInstance.Initialize(ProjectRootElement xml, IDictionary2 globalProperties, String explicitToolsVersion, String explicitSubToolsetVersion, Int32 visualStudioVersionFromSolution, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, Nullable1 projectLoadSettings, EvaluationContext evaluationContext) at Microsoft.Build.BackEnd.BuildRequestConfiguration.<>c__DisplayClass60_0.<LoadProjectIntoConfiguration>b__0() at Microsoft.Build.BackEnd.BuildRequestConfiguration.InitializeProject(BuildParameters buildParameters, Func1 loadProjectFromFile) at Microsoft.Build.BackEnd.RequestBuilder.d68.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Build.BackEnd.RequestBuilder.d59.MoveNext() Converter

Using

Not too sure why this issue is creeping back into MSBuild as I'm sure it was resolved in VS 2019

jrdodds commented 1 year ago

Just to confirm: Are you building from the same directory path in VS2022 as you did in VS2019? Do you still have VS2019 installed? The same solution on the same machine in the same directory path builds successfully in VS2019 and fails in VS2022?

MariusEls commented 1 year ago

Good afternoon

Are you building from the same directory path in VS2022 as you did in VS2019? Yes

Do you still have VS2019 installed? Yes

The same solution on the same machine in the same directory path builds successfully in VS2019 and fails in VS2022? Yes

Thank you and Regards

On Tue, 04 Apr 2023 at 16:18, Jonathan Dodds @.***> wrote:

Just to confirm: Are you building from the same directory path in VS2022 as you did in VS2019? Do you still have VS2019 installed? The same solution on the same machine in the same directory path builds successfully in VS2019 and fails in VS2022?

— Reply to this email directly, view it on GitHub https://github.com/dotnet/msbuild/issues/8629#issuecomment-1496056859, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOCPAENZLEFFCZO4HWBTHLW7QUS5ANCNFSM6AAAAAAWSVZQWY . You are receiving this because you authored the thread.Message ID: @.***>

-- Regards

Marius Els +27 82 389 9499 "...as for me and my house, we will serve the Lord."- Joshua 24:15 b