.net - 使用 Clickonce 部署 Microsoft.Bcl.Async

标签 .net vb.net asynchronous base-class-library

我有一个因以下错误而崩溃的 VB.NET 应用程序:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'System.Threading.Tasks, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
我正在尝试使用 Microsoft.Bcl.Async 库。我已经通过 Nuget 在实际使用 Async/Await 调用的项目和引用它的项目上安装了它。在我的计算机上一切正常,但是当我在另一台计算机上发布和测试时,当我尝试使用其中使用 Async/Await 的部分时,我的程序崩溃了。

System.Threading.Tasks 在复制本地设置为 true 的两个项目中都被引用。 Microsoft.Threading.Tasks 在复制本地设置为 true 的两个项目中都被引用。我见过the other thread关于这一点,它已安装在相关项目中。这些是我的 app.config 文件中包含的行:

  <dependentAssembly>
    <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
  </dependentAssembly>

设置这个我错过了什么?如果您需要更多信息,请告诉我。谢谢!

最佳答案

我在项目网站上找到了一个解决方法:

http://blogs.msdn.com/b/bclteam/p/asynctargetingpackkb.aspx

解析度

这是因为 ClickOnce 无法部署某些必需的程序集。作为解决方法,请执行以下操作:

1.右键单击项目并选择添加现有项目

2.浏览到Microsoft.Bcl net40包文件夹

3.在文件名文本框中输入 .

4. 按住 CTRL,选择 System.Runtime.dll 和 System.Threading.Tasks.dll

5.单击添加按钮旁边的向下箭头,然后选择添加为链接

6.在解决方案资源管理器中,按住 CTRL 选择 System.Runtime.dll 和 System.Threading.Taks.dll

7.右键单击选择,选择属性并将复制到输出目录更改为始终复制

8.重新发布

关于.net - 使用 Clickonce 部署 Microsoft.Bcl.Async,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18498453/

相关文章:

c# - 如何在每个第二个引号处拆分

mysql - DirectCast MySQL BLOB 到 PictureBox

c# - 保持 Form 实例打开的任务?

.net - 是否有用于信用卡加密的最佳 .NET 算法?

c# - 使用 MVVM 的 WPF 导航

mysql - 检查与您的 mariadb 服务器版本对应的手册,了解在第 1 行 "user"附近使用的正确语法

c# - 记录操作延迟

jquery - 在循环中使用 jQuery 延迟并完成异步 SQLite 数据库查询

c# - 当我组合单击按钮和异步联系人调用时出现无限循环

.net - Windows 10 上的 SQL Server 2014