gpt4 book ai didi

.net - 无法添加对 System.IO、System.Runtime 和 System.Threading.Tasks 的引用

转载 作者:行者123 更新时间:2023-12-03 17:41:48 31 4
gpt4 key购买 nike

我正在使用 Visual Studio Community 2015 开发面向 .NET 4.5 的 Visual Basic 应用程序.我没有编写应用程序,所以我使用 NuGet 添加了所有缺失的依赖项但是无论我尝试什么,我都无法添加 3 个依赖项。这是我在构建项目时遇到的众多错误之一:

This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567.



这是依赖项:
  • System.IO
  • System.Runtime
  • System.Threading.Tasks

  • 我尝试使用 NuGet 安装它们但是我在尝试安装时遇到此错误 System.IO也安装 System.RuntimeSystem.Threading.Tasks :

    Could not install package 'System.Runtime 4.0.20'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.



    我还尝试手动添加它们添加 .dll在我的情况下是:
  • C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.IO.dll
  • C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Runtime.dll
  • C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Threading.Tasks.dll

  • 但也不起作用。我也尝试删除 System.Runtime正如它所说的 here和答案 here ,两者都没有成功。

    这是我的图片 References :

    enter image description here

    最佳答案

    我也面临这个问题。我已经解决了这个问题

  • 删除 bin 和 obj 文件夹
    您可以使用以下命令清除您的项目 bin 和 obj 文件夹。
    打开您的推荐提示,转到您项目的根目录,然后在推荐下方运行

    FOR/F "tokens=*"%G IN ('DIR/B/AD/S bin') DO RMDIR/S/Q "%G

    FOR/F "tokens=*"%G IN ('DIR/B/AD/S obj') DO RMDIR/S/Q "%G
  • 删除我机器中的临时文件

  • 为避免将来出现此问题,请维护单独的文件夹 (DependentAssembly) 来存储这些程序集。当 nuget 恢复包时,它会更新一个新的包 dll。因此,由于在新程序集中对现有方法进行了一些更改,可能会出现构建错误。
    enter image description here

    关于.net - 无法添加对 System.IO、System.Runtime 和 System.Threading.Tasks 的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34446628/

    31 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com