Visual Studio 2010 SharePoint Error: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.
I think a lot of people probably see this error at some point in time and they always assume it has something to do with the name of the project or the name of the feature. What is really happening here is that one of the file names within the package manifest is just too long. It can be any file… whether its deployed to a Mapped Folder, the Features folder, or whatever. What I typically do is go into Visual Studio, click on the option to show all files in Solution Explorer:
And then find the pkgobj folder. From there you can drill into the Debug/Release (depending on your build config) folder and sort through the various xml and element manifests to find some particularly offensive filenames. A good place to start would be the generated Package_Manifest.xml file. A lot of times if you have a particularly long project name then you can get stuck with stupid paths deploying to ControlTemplates (visual web part) folders and the like.
Also, I would always organize your SharePoint projects somewhere not in the default My Documents folder in Visual Studio. Put them somewhere off of a drive root. In my VMs, I like to have a separate virtual external drive that I put all of my project work on. So for example all of my projects come in at something like: F:\projects\