I have run into this issue a number of times over the past year for some reason engineers just want to name a project, class or solution what it is without having to think about string lengths and file systems. I like to keep my projects folder in my user profile because that's where everything else is... neat and tidy. Thankfully a solution, something that hearkens back to the of flannel, blue jeans and birkenstock sandals with socks possibly where this limitation all started.
After solving this now for the 4th time the following works the best. Take the code below paste it into notepad and change the path to your source location. Remember to keep two \\ slashes for every one in the reg file or it wont work. You will have to reboot your computer for the change to take effect.
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices] "P:"="\\??\\D:\\Path\\To\\Your\\Code"
To solve the problem I simply add a batch file to my start up folder that creates a drive substitution.
@ECHO OFF SUBST P: "%USERPROFILE%\My Projects"
How the characters limitation is calculated:
Path length + 1 (separator) + Solution name length + 1 (separator) + Project name length + 1 (separator) + Project name length + 80 (Reserved space)
Dude where is my admin?
Create a shortcut to the batch/cmd fileRight click on propertiesReplace the Target with: %windir%\System32\cmd.exe /c "Map Projects.cmd"Click "Advanced..."Check "Run as administrator"
- Create a scheduled task that runs on login of your user account or system startup
- Set the task to run under the user you want P for
- Enter SUBST as the program name
- Instead of %USERPROFILE% use the full path
- Enter P: "C:\Users\{Your Account Name Here}\My Projects" in the arguments box
- Run the task manually if you get a 0 result you have successfully configured P