因此,我一直在使用C#以WPF格式构建“游戏启动器”,并且运行良好,但是由于内置IE的局限性,现在我改用CefSharp作为Web浏览器组件一。从那时起,每次发布ClickOnce并尝试安装时,它都可以很好地安装,但不会打开。我检查了事件日志,可以看到以下两个问题。
我已尝试重建.net并确保已将所有必需的文件作为发布的一部分,但似乎仍无法正常工作。
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
at System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Reflection.RuntimeAssembly, System.Threading.StackCrawlMark ByRef, IntPtr, Boolean, Boolean, Boolean)
at System.Reflection.Assembly.Load(System.Reflection.AssemblyName)
at System.Windows.Baml2006.Baml2006SchemaContext.ResolveAssembly(BamlAssembly)
at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlTypeToType(BamlType)
at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType, Int16)
at System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16)
at System.Windows.Baml2006.Baml2006Reader.Process_ElementStart()
at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
at System.Windows.Baml2006.Baml2006Reader.Process_BamlRecords()
at System.Windows.Baml2006.Baml2006Reader.Read()
at System.Windows.Markup.WpfXamlLoader.TransformNodes(System.Xaml.XamlReader, System.Xaml.XamlObjectWriter, Boolean, Boolean, Boolean, System.Xaml.IXamlLineInfo, System.Xaml.IXamlLineInfoConsumer, MS.Internal.Xaml.Context.XamlContextStack`1<System.Windows.Markup.WpfXamlFrame>, System.Windows.Markup.IStyleConnector)
at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)
Exception Info: System.Windows.Markup.XamlParseException
at System.Windows.Markup.XamlReader.RewrapException(System.Exception, System.Xaml.IXamlLineInfo, System.Uri)
at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader, Boolean, System.Object, System.Xaml.Permissions.XamlAccessLevel, System.Uri)
at System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream, System.Windows.Markup.ParserContext, System.Object, Boolean)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(System.IO.Stream, System.Windows.Markup.ParserContext)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__1_0(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at AussieAdventures_Game_Launcher.App.Main()
还有:
Faulting module name: KERNELBASE.dll, version: 10.0.18362.1, time stamp: 0x1a30e11b
Exception code: 0xe0434352
Fault offset: 0x000000000003a839
Faulting process id: 0x1224
Faulting application start time: 0x01d53ddd3ba81710
Faulting application path: C:\Users\%USERNAME%\AppData\Local\Apps\2.0\JB3QLMCD.VJM\3H1APX8K.J46\auss..tion_9e5937fe9f80aee9_0001.0001_024cc7db72a39b7c\AussieAdventures Game Launcher.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: e1cea3d5-5770-488c-9c3d-91c86fe438fb
Faulting package full name:
Faulting package-relative application ID:
如果我构建应用程序(而不是发布)并运行它,则可以正常运行。仅在使用ClickOnce时失败。
更新:
@amaitland我确实读过。我尝试过,但似乎没有任何区别。 (抱歉,我还是很新)
<Import Project="packages\CefSharp.Common.73.1.130\build\CefSharp.Common.targets" Condition="Exists('packages\CefSharp.Common.73.1.130\build\CefSharp.Common.targets')" />
<Import Project="packages\CefSharp.Wpf.73.1.130\build\CefSharp.Wpf.targets" Condition="Exists('packages\CefSharp.Wpf.73.1.130\build\CefSharp.Wpf.targets')" />
<ItemGroup>
<Content Include="$(SolutionDir)packages\cef.redist.x64.73.1.13\CEF\**\*" Exclude="$(SolutionDir)packages\cef.redist.x64.73.1.13\CEF\x64\**\*;$(SolutionDir)packages\cef.redist.x64.73.1.13\CEF\locales\**\*.pak">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
<Resource Include="aalogo_QMC_icon.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="$(SolutionDir)packages\cef.redist.x64.73.1.13\CEF\**\en-US.*;$(SolutionDir)packages\cef.redist.x64.73.1.13\CEF\**\de.*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="$(SolutionDir)packages\ccef.redist.x64.73.1.13\CEF\x64\**\*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="$(SolutionDir)packages\CefSharp.Common.73.1.130\CefSharp\x64\**\CefSharp.BrowserSubprocess.*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>
</Target>```