最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

frameworks - Published .NET application crashes when using \? file name notation - Stack Overflow

programmeradmin4浏览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 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 app ( 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 framework 4.8?

发布评论

评论列表(0)

  1. 暂无评论