PathTooLongException Xamarin Droid Project
Asked Answered
P

2

13

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

Paradisiacal answered 20/2, 2017 at 16:2 Comment(4)
Possible duplicate of The "GenerateJavaStubs" task failedJezabelle
Why can't you change your project path? This is probably the only way to resolve this.Unguent
Well it dosen´t make much sense to me having to change my project path just because xamarin projects only allow 248 characters.Paradisiacal
But thanks anyway xamarin got the best of me and i changed my project name to be shorter.Paradisiacal
S
34

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.

Stannic answered 22/6, 2017 at 3:2 Comment(2)
UseShortFileNames didn't work for me, but changing the IntermediateOutputPath didRenitarenitent
Like @Renitarenitent said, the latter solution did the job. First one however did not.Silo
S
3

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

Scotty answered 22/6, 2017 at 10:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.