通过NuGet更新后OpenTK应用程序崩溃

问题描述

通过NuGet安装新版本的OpenTK后,我们的Windows窗体应用程序崩溃。该应用程序的其余部分可以运行,但是使用OpenTK部件的表单在加载时只会使该应用程序崩溃。我们的应用程序中包含两个dll,即OpenTK.dll和OpenTK.GLControl.dll,到目前为止,它们已经使用了两个类似的版本。 NuGet提供更新,但是两个dll的版本不同:第一个为v3.2.0,第二个为v3.1.0,这也可能导致错误或需要将NuGet信息存储到.config.exe文件中。

在删除Application.config.exe(NuGet存储以下行)之后,我们才有此问题:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="OpenTK" publicKeyToken="bad199fe84eb3df4" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" />
  </dependentAssembly>
</assemblyBinding>

我们希望不带.config.exe文件的情况下提供.exe,并想知道是否存在将此配置放入.exe文件的方法,使我们能够在可用时更新到新版本的OpenTK。

解决方法

构建项目时,Application.config.exeapp.config文件在输出文件夹下创建。它在运行时适用于应用程序。如果要运送不带.config.exe文件的.exe,则可以将app.config嵌入exe,然后在 bin 上删除默认的Application.config.exe。文件夹。

1) App.config Build Action 更改为Embedded Resource

enter image description here

2)删除binobj并重建您的项目以生成新的输出文件。

3),则可以使用已经嵌入app.config文件的 application.exe 文件。

之后,您可以删除默认情况下VS从application.config.exe生成的app.config。并且它已经嵌入在applciation.exe中。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...