Visual Studio警告IDE0006的解决办法 引用的dll或者包出现黄色叹号

首先这种错误,一般是web项目出现的。
一、按照微软官方给的解决方案,查找错误日志:

1. 关闭 Visual Studio。

  1. 删除解决方案下的.vs文件夹,这个文件夹默认是隐藏的,找不到的需要打开隐藏文件设置

3. 打开 Visual Studio 开发人员命令提示符 //开始菜单中找Developer Command Prompt for VS 2017

  1. 将环境变量 " TraceDesignTime" 设置为 true (设置成 TraceDesignTime=true)

在命令行中运行命令


set TraceDesignTime=true

devenv
  1. 在上一步打开的vs中打开解决方案
  2. 找到生成的日志,在“C:Users你的用户名AppDataLocalTempECharts*.designtime.log”并查找失败任务(FAILED) //日志文件有多个,根据需要查看。类似下面代码:
生成失败。

***: error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..packagesMicrosoft.Net.Compilers.1.0.0uildMicrosoft.Net.Compilers.props.
    0 个警告
    1 个错误

二、我遇到的错误是:

This project references NuGet package(s) that are missing on this computer. Nuget包无法还原,引用的dll显示为黄色叹号。

在网上找到的解决方案:

  1. 打开web项目的.csproj 文件,一般是asp.net mvc web项目会出现上述错误,找到以下代码,删除
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
  <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('......AssembliesNuGetSpecFlow.Plus.Excel.1.4.2uildSpecFlow.Plus.Excel.targets')" Text="$([System.String]::Format('$(ErrorText)', '......AssembliesNuGetSpecFlow.Plus.Excel.1.4.2uildSpecFlow.Plus.Excel.targets'))" />

2. 在vs中,打开程序包管理控制台,执行以下命令重新安装包:

Update-Package –reinstall
问题解决

原文地址:https://www.cnblogs.com/AlexanderZhao/p/11343523.html