sensenet

Path Too Long Error when importing into Sensenet


I am trying too import some content into Sensenet, but it throws the following error:

14:12:12.4025   ========== Exception:
14:12:12.4155   Path: C:\Users\Administrator\source\repos\WebApplication6\WebApplication6\Admin\tools\import_legacy_content\content\workspaces2\IPA2013\Framework Workspaces\13SER01_2f15_2f71\ExAnteReviewList\ExAnteReview\Transmission_5fNote_5f1_5ffor_5fDIS_5f13SER01_5f14_5f71_5focr.pdf.Content
14:12:12.4315   ApplicationException: Cannot create a ContentInfo. Path: C:\Users\Administrator\source\repos\WebApplication6\WebApplication6\Admin\tools\import_legacy_content\content\workspaces2\IPA2013\Framework Workspaces\13SER01_2f15_2f71\ExAnteReviewList\ExAnteReview\Transmission_5fNote_5f1_5ffor_5fDIS_5f13SER01_5f14_5f71_5focr.pdf.Content
14:12:12.5955      at SenseNet.Packaging.Steps.ImportBase.ContentInfo..ctor(String path, Node parent)
   at SenseNet.Packaging.Steps.ImportBase.ImporterClass.TreeWalker(String path, Boolean pathIsFile, Node folder, String indent, Boolean aspects, Boolean settings)
14:12:12.6115   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.
14:12:12.6625      at System.IO.Path.NewNormalizePathLimitedChecks(String path, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.InternalGetDirectoryName(String path)
   at SenseNet.Packaging.Steps.ImportBase.ContentInfo..ctor(String path, Node parent)
14:12:12.6885   =====================

I made changes to the Registry and Group Policies to enable support for long file names, but the error still appears. Do I need to make changes to some Sensenet config files in order for this to work?

Thanks


Solution

  • Windows has a limitation to 256 characters for file paths and won't work anything longer than that. With an update Windows 10 removed this limitations but it's not guaranteed that legacy softwares like snadmin will work with that. See Maximum Path Length Limitation

    Another workaround to shorten the entry point for the tool, for example from

    C:\Users\Administrator\source\repos\WebApplication6\WebApplication6\Admin\tools\import_legacy_content\content\workspaces2\IPA2013\Framework Workspaces\13SER01_2f15_2f71\ExAnteReviewList\ExAnteReview\Transmission_5fNote_5f1_5ffor_5fDIS_5f13SER01_5f14_5f71_5focr.pdf.Content

    to

    C:\tools\import_legacy_content\content\workspaces2\IPA2013\Framework Workspaces\13SER01_2f15_2f71\ExAnteReviewList\ExAnteReview\Transmission_5fNote_5f1_5ffor_5fDIS_5f13SER01_5f14_5f71_5focr.pdf.Content

    To achieve this relative or absolute path can be used with snadmin, see at Arguments

    With the above example I assume it would be see like this:

    SnAdmin.exe 'C:\tools\import_legacy_content.zip'