This project is read-only.


cannot debug project anymore


I can no longer debug one of my projects. The build output window shows the following. I'm not exactly sure what has changed, but it used to debug fine. I didn't change the path, so I can't imagine how there are any illegal characters in it. Please let me know if there is any more information I can give.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Node.js Tools\Microsoft.NodejsTools.targets(137,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.CheckIllegalCharacters(String[] str)
   at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
   at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
   at System.IO.Path.GetFullPath(String path)
   at Microsoft.Build.Tasks.AssignTargetPath.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
Done building project "api-server.njsproj" -- FAILED.

Closed Sep 16, 2014 at 6:43 PM by RickWinter
Unfortunately this is a limitation outside our controls. We're are working hard to improve the situation but for now you'll need to root the project at the shortest path possible.


jhowe11 wrote Aug 22, 2014 at 1:32 PM

You could try the solution I used to remove the AssignTargetPath error from this thread.

However, I currently can't debug either :(

lwolfe wrote Aug 28, 2014 at 12:28 AM

It sounds like this is also the MAX_PATH issue that is floating around. I believe the problem started when I added gulp to devDependencies. I've moved my code to a really short folder name off of C:\ and it seems to be working again.

bartvanderwal wrote Jan 5, 2016 at 12:34 PM

I was - suddenly - having this exact same issue. I moved to a very short path ('C:/Code'), but that was probably not enough, because it didn't change the error.

But the issue WAS related to the MaxPath, because I was on Windows, and in the end managed to fix this by upgrading from npm 2 to npm 3. And then ofcourse deleting all npm packages of my project (rm -r node_modules1) and reinstalling them (witn npm install). In npm3 . Though a drawback might be that the npm team has indicated it's still in beta, and that for real stability and migration you'd have to wait until npm4. I don't know enough about specifics. But it worked for me.

As you see I was working in git bash. You can confirm it's a MAXPATH issue with this command.
(find | awk '{ print length(), NR, $0 | "sort -rn" }' | less)

You are dropped in less editor. Check the first column/number, lines are ordered by lenght so just check the first line. Length should be below 256. Exit the editor with :q :). You should add base path lenght yourself.