System.IO.PathTooLongException: The specified path, file name, or both are too long.

Ask general questions here.
bhavani
Posts: 12
Joined: Mon Mar 25, 2019 6:51 am

System.IO.PathTooLongException: The specified path, file name, or both are too long.

Post by bhavani » Mon Jul 15, 2019 7:04 am

Hi,

I tried executing the exe file through ranorex agent from Powershell. In Ranorex Agent logs there is an exception which states that file name too long.
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.
at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.InternalGetDirectoryName(String path)
at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, String password)
at Ionic.Zip.ZipFile._InternalExtractAll(String path, Boolean overrideExtractExistingProperty)
at Ranorex.Dex.Common.Util.ArchiveIO.ExtractAll(AbsoluteFilePath zipFile, AbsoluteDirPath destinationDir)
at Ranorex.Dex.Components.TestExecution.Steps.FetchTestSuiteStep.ExecuteStep(StepExecutionInformation config, ProgressLogger progress)
at Ranorex.Dex.Components.TestExecution.Steps.ExecutionStep.Execute(StepExecutionInformation config, ITaskProgress`1 p).

PFA logfile.
These temp paths are nowhere provided in the ranorex solution. What needs to be changed. Any suggestions on this would be really helpful

Regards,
Bhavani V
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: System.IO.PathTooLongException: The specified path, file name, or both are too long.

Post by Support Team » Wed Jul 17, 2019 2:23 pm

Hello bhavani,

Unfortunately, windows enforces a character limit on file names and directories. If you are using server 2016 or windows 10 you can enable long paths by following the respective guides below:

Server 2016 - https://eocloud.cloudferro.com/knowledg ... cle&id=135
Windows 10 - https://betanews.com/2016/05/29/long-paths-windows-10/

Alternatively, you can edit the registry and make the %localAppData% folder name more shallow, this is the local execution directory when using Agent. It is highly recommended this be changed back as it may affect other application that utilizes the directory.

Registry Key - Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

Guide - https://www.windows-commandline.com/cha ... -location/

Regards,
Sean