Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PathTooLongException Xamarin Droid Project

I Created a Xamarin.Forms project with a long path, and while building it I get this error:

"System.IO.PathTooLongException: 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 can't change my project path neither my project name, it has to have that specific name.

Can any one help we find a workaround this problem please?

Thanks

like image 371
brunof.89 Avatar asked Feb 20 '17 16:02

brunof.89


2 Answers

Try adding this msbuild property in your project that will shorten the file/folder names on the obj directory

<PropertyGroup>
    <UseShortFileNames>True</UseShortFileNames>
</PropertyGroup>

Or this to change the output folder to a one closer to the C:\

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <IntermediateOutputPath>C:\MyFolder\MyProj</IntermediateOutputPath>
</PropertyGroup>

Hope it helps.

like image 101
fmaccaroni Avatar answered Oct 31 '22 10:10

fmaccaroni


Probably the easiest temporary solution is to move your project to a drive's root folder to decrease the length of the path.

like image 22
user8199308 Avatar answered Oct 31 '22 11:10

user8199308