Mar Tin
Mar Tin

Reputation: 2392

Azure DevOps error MSB4184: The expression "[MSBuild] :: NormalizePath (path)" cannot be evaluated

In my team we have a project with a very long path. When I try to compile the solution of the project in a Visual Studio-Build task, we get the error:

error MSB4184: The expression "[MSBuild] :: NormalizePath (path)" cannot be evaluated. The path "path" exceeds the maximum path limit of the operating system. The fully qualified file name must be less than 260 characters.

We use self-hosted agents. I try to fix this issue with Enable Long Paths in Windows 10 and add a dword FileSystem LongPathsEnabled to the agent registry. Unfortunately the issue still occurs, what can I do to solve?

Upvotes: 0

Views: 2171

Answers (1)

Hugh Lin
Hugh Lin

Reputation: 19361

According to the issue on github : As of Visual Studio 2019 Preview 2 (which includes MSBuild 16.0.360-preview), MSBuild.exe now (as of #3507) opts into support for long paths. But this does not mean things work, just because MSBuild works, doesn't mean your build will, because many other tools are involved. devenv.exe, the main Visual Studio process, does not yet opt into support. That means only command-line builds will be affected by the MSBuild changes.

So I am afraid that long path is currently not supported in visual studio build task. Until now, in our official feature suggestion for Developer Community forum, there has been a such suggestion exist in it. You can comment and vote it there.

In addition, it seems that there is no such annoyance with the 32-bit version(restores and builds without issue).

Upvotes: 1

Related Questions