While working on my Node project using Node Tools for Visual Studio (version 1.1), I encountered this error unexpectedly. I was using Visual Studio Community Edition 2015 and had the latest version of Typescript (v1.7.6) installed.
Error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Node.js Tools\Microsoft.NodejsTools.targets(119,5): error MSB4018: The "AssignTargetPath" task failed unexpectedly.
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)
at Microsoft.Build.Tasks.AssignTargetPath.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Done building project "BuyCo.njsproj" -- FAILED.
Build FAILED.
Upon researching online, it appears that the issue may be related to the MAXPATH problem with Node/npm.