aspnet / JavaScriptServices

[Archived] This repository has been archived
Apache License 2.0
3.03k stars 518 forks source link

PathTooLongException #288

Closed Knaackee closed 8 years ago

Knaackee commented 8 years ago

I cant run the ReactRedux template in Visual Studio 2015 because of the following exception.

Error   MSB4018 The "FindConfigFiles" task failed unexpectedly.
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetDirectoryName(String path)
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.EnumerateFiles(String path)
   at TypeScript.Tasks.FileHelpers.RecursiveGatherFiles(String directoryPath, String projectPath, Func`2 filter)
   at TypeScript.Tasks.FileHelpers.RecursiveGatherFiles(String directoryPath, String projectPath, Func`2 filter)
// ...

The reason is, off course, the long folder path and the limitation of windows.

How to deal with this? Is there something i can do without simply moving my project to another, shorter folder?

MarkPieszak commented 8 years ago

Unfortunately not much besides sharing a subfolder, or using command line to assign a drive.

What I'd recommend is storing your projects directly on C:\, on my Windows machine everything is on C:\Git\ (or whatever you'd like) with relatively short project names, and I've never ran into the problem. Visual studio by default wants you to save projects in an already long location name (so many sunfolders), give this a shot and you'll be surprised you never see the problem again!

Knaackee commented 8 years ago

Thanks! That worked great. Another short question, maybe you could help here too. My project has multiple projects . Lets say.

My Problem is that if i select "MyApp.Web" as the start project. I get "error DOTNET1017: Project file does not exist 'C:\MyApp\project.json'.".

MarkPieszak commented 8 years ago

Was this already happening, or now after you moved it? What if you do a dotnet restore on that root-level C:\MyApp\ directory?

Knaackee commented 8 years ago

This was happening before too. I was getting around this by opening only the project "MyApp.Web". But i want to open the solution to get debugging for the "MyApp.Core" too.

MarkPieszak commented 8 years ago

Is there a project.json at that root level?

Knaackee commented 8 years ago

No, only the global.json.

MarkPieszak commented 8 years ago

Nevermind don't think it needs to, what about that second project, does it have one as well? You might need to dotnet restore on that project itself (if visual studio didn't restore the packages for you automatically). Just tried adding a separate NETCore Web API project to an existing default yeoman template and it ran fine, strange.

Knaackee commented 8 years ago

Yes, thats really strange. I am doing aspnet mvc for many many years now, but i really have some problems with this templates.

I will report back if i found something.

SteveSandersonMS commented 8 years ago

I'm not sure what particularly is going wrong in your scenario, but it sounds independent of anything in JavaScriptServices (it's a general question about debugging .NET core apps), so I'll close this. If you think there's something specific we can improve in the JavaScriptServices templates, please let us know!

max-favilli commented 8 years ago

Are you including react from cdn or installed via npm? Maybe you installed some other react module from npm? Which version of npm are you using? If you have installed react and modules via npm, and you have done so with the npm and you have not updated npm to version 3+ this is likely to occur due to many modules file names exceeding windows filename length limits. If that is the scenario, just update npm to 3+, from version 3 npm use short file names. Keep in mind visual studio 2015-update-3 is still bundled with npm 2.