cefsharp / CefSharp

.NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework
http://cefsharp.github.io/
Other
9.87k stars 2.92k forks source link

WinForms - Net 6 PublishSingleFile FileNotFoundException #4150

Closed EVA-SS closed 2 years ago

EVA-SS commented 2 years ago

微信截图_20220630162835

        static int Main(string[] args)
        {
            var exitCode = CefSharp.BrowserSubprocess.SelfHost.Main(args);
            if (exitCode >= 0)
            {
                return exitCode;
            }
                var settings = new CefSharp.WinForms.CefSettings()
                {
                    MultiThreadedMessageLoop = true,
                    IgnoreCertificateErrors = true,
                    CachePath = Program.CachePath,
                    LogSeverity = LogSeverity.Disable,
                    BrowserSubprocessPath = ExePath
                };
                Cef.Initialize(settings, false);
    <PropertyGroup Condition="'$(TargetFramework)' == 'net6.0-windows' AND '$(PublishSingleFile)' == 'true'">
        <!-- Extract all files to disk at runtime -->
        <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
        <!-- Include our native files in the resulting exe -->
        <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
    </PropertyGroup>
amaitland commented 2 years ago

Did you install the Visual C++ Runtime?

As it stands this will be converted to a discussion as it's unlikely a bug.