Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable "Long Path Aware" behavior via manifest in a C++ executable?

I'm trying to follow Microsoft documentation to lift MAX_PATH file path restriction in APIs under Windows 10. It says:

You can also enable the new long path behavior per app via the manifest:

<application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
        <ws2:longPathAware>true</ws2:longPathAware>
    </windowsSettings>
</application>

So, first question. Is it possible to enable it in project properties in Visual Studio 2017?

Second question: I failed to find an answer above, so I decided to go a manual route:

  1. I created the additional.manifest text file as such:

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
    <application xmlns="urn:schemas-microsoft-com:asm.v3">
        <windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
            <ws2:longPathAware>true</ws2:longPathAware>
        </windowsSettings>
    </application>
    </assembly>
    
  2. I then added it to the project properties:

enter image description here

  1. But then when I compile it, it gives me this warning, and that manifest seems to have no effect when the application runs:

1>additional.manifest : manifest authoring warning 81010002: Unrecognized Element "longPathAware" in namespace "http://schemas.microsoft.com/SMI/2016/WindowsSettings".

So what am I doing wrong?

like image 322
c00000fd Avatar asked Dec 24 '18 22:12

c00000fd


People also ask

How do I enable Windows long path support?

Press Win + R keys on your keyboard and type gpedit. msc then press Enter. Group Policy Editor will be opened. Go to Local Computer Policy -> Computer Configuration -> Administrative Templates -> System -> Filesystem, then enable the Enable Win32 long paths option.


1 Answers

No. There is no switch in the Visual Studio 2017 v15.9.4 project properties for Windows Desktop or Console Applications to enable "Long Path Aware".

The Microsoft Documentation that you linked above says following:

Starting in Windows 10, version 1607, MAX_PATH limitations have been removed from common Win32 file and directory functions. However, you must opt-in to the new behavior.

Make sure you target a Windows SDK for Windows 10, version 1607 or above for your used configuration and a current toolset. You need at least Windows SDK v10.0.14393.795. Current version is v10.0.17763.0.

You can find and change the targeted Windows SDK version and the targeted toolset in the "General" property sheet of the project's properties.

Side note: Make overall configuration changes active in all configurations. Change the property sheet's configuration options to "All configurations" and "All Platforms" except you make a change specifically for a platform.

like image 178
FA85 Avatar answered Sep 26 '22 06:09

FA85