Visual Studio SharePoint Packaging / Deployment
So there I was, just working away and minding my own business when Visual Studio 2010 decided to throw a very nasty curve ball at me. The new SharePoint Development Tools native to 2010 are really nice – particularly the ‘Deploy’ and ‘Retract’ stuff whereby I can create a SharePoint Project, write my code, and I DON’T have to mess with all the goo of WSPBuilder, command lines, bat files, etc to get my stuff into SharePoint. All I have to do is hit F5, or, Deploy and off it goes (locally of course). However, when you create your Package file by letting VS do all of the hard work, a nasty little gotcha can crop up:
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.
WTF!
Well, after spending a few HOURS trying to figure out what exactly was wrong, I found these two folders that are being used in relation to the Package tools that are run when you go to deploy using Visual studio:
pkg and pkgobj
These two folders are the structure folders for that tool and they recreate a lot of the path structure information for SharePoint underneath them. In my case, I have a naming convention for my projects:
c:programmingtrunk<namespace.applicationname.version><solution folder><programming folder>
Underneath that is pkg and pkgobj. I counted my characters to that point; good so far. But then you dive into pkg and it goes crazy:
…pkgdebug<namespace.applicationname.version>CONTROLTEMPLATES<namespace.applicationname.version><a web part name here><a web part user control file here.aspx> — BOOM – WAY more than 260 characters and I’m now having a bad day.
This isn’t so much a Visual Studio Problem, but rather an NTFS limitation on the ol computer. The only solution? Start shortening the names. In my case, I shrunk down EVERYTHING up to pkg (because I can’t control much underneath that folder) to fix.
Annoyance!