ASP.NET Publish Error (The specified path, file name, or both are too long)

That is a Windows limitation. You can disable it this way:

  1. Execute 'regedit.exe'
  2. Navigate to "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem"

  3. Find a value named LongPathsEnabled and double-click it. If you don’t see the value listed, you’ll need to create it by right-clicking the FileSystem key, choosing New > DWORD (32-bit) Value, and then naming the new value LongPathsEnabled

  4. Change the value from 0 to 1 in the “Value data” box and then click OK.

After that, you would probably have to restart visual studio.


Windows has a limitation that can be configured. See NicoRiff's answer.

That beeing said, the following string is "only" 173 chars long:

obj\Release\Package\PackageTmp\Areas\AdminPanel\Content\assets\global\plugins\bootstrap-editable\inputs-ext\wysihtml5\bootstrap-wysihtml5-0.0.2\bootstrap-wysihtml5-0.0.2.css

I suggest you, to create a folder in the root of your disc, for example D:/Dev where all your projectes are stored.

Changing the registry would also be an option, but needs to be configured for every developer, which is suboptimal. Generaly you should go for shorter paths. Checkout and Build should be the motto.

When you ship the software you should also minify/bundle your client side scripts. This way you only have one short path bundle.css in your published output.