0

The following code works on debug builds, it works on release builds and it works when manually executing a published executable in the published dir (eg "..\Application Files\WindowsApp1_1_0_1_0\WindowsApp1.exe").

However, when running the .application to execute the published application, it throws the following error: "Illegal characters in path".

I am using the '\\?\' notation because my application needs to support long file names. I believe this notation is supported from .net framework 4.7.2.

    For Each f As String In IO.Directory.GetFiles("\\?\c:\")
        Console.WriteLine(f)
    Next

Environment: VS 2022 publishing a winforms vb.net app (.net framework 4.8).

Why would this code work perfectly in all cases except when running a published .application file and how do I work around this issue while still being able to use long file names on .net framework 4.8?

2
  • Did you include <ws2:longPathAware>true</ws2:longPathAware> in the app config as documented learn.microsoft.com/en-us/windows/win32/fileio/… Commented Mar 31 at 23:55
  • Tried that, did not make a difference Commented Apr 2 at 22:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.