Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio and maximum length of the path of a project reference

We have a number of projects, and each lives deep in a folder structure. When one set of projects needs to reference a project in a different folder, the reference can fail because the relative path to is in VS is too long.

For example, project 1 will be in:

C:\folderA\folder1\folder2...\folderN\myProject1.csproj

It references another project:

C:\folderB\folder1\folder2...\folderN\myProject2.csproj

The HintPath to the reference is stored as a relative path, as in ............\folderB\folder1\folder2...\folderN\myProject2.csproj

When VS loads the solution, it can't resolve the reference because the absolute path it builds includes numerous ../'s such that the path exceeds 256 characters. And the build fails.

We fix it by editing the csproj and putting in an absolute path, which is just silly.

What is the best solution for this?

like image 551
Daniel Williams Avatar asked Nov 05 '11 04:11

Daniel Williams


2 Answers

The max recommended project name length is 64 char. Team foundation server do not allow more than 64 char See the following link http://www.grabthecode.com/visual-studio/length-of-visual-studio-project-name

like image 98
Ch Kamran Naveed Avatar answered Oct 05 '22 23:10

Ch Kamran Naveed


Short answer - don't do that and it will not hurt. Consider less deep hierarchies and make related projects to live close.

MSBuild is managed application and CLR have restriction on path/file name length of about 256 characters...

like image 33
Alexei Levenkov Avatar answered Oct 06 '22 00:10

Alexei Levenkov