任务意外失败 "GenerateResource"

Unexpected failure of the task "GenerateResource"

当我尝试调试我的通用应用程序项目时出现神秘错误,这是我收到的错误:

Unexpected failure of the task "GenerateResource"

System.NullReferenceException: Object reference not set to an instance of an object.
   à Microsoft.Build.Tasks.ResGenDependencies.TryGetPortableLibraryInfo(String libraryPath)
   à Microsoft.Build.Tasks.GenerateResource.GetResourcesToProcess(List`1& inputsToProcess, List`1& outputsToProcess, List`1& cachedOutputFiles)
   à Microsoft.Build.Tasks.GenerateResource.Execute()
   à Microsoft.Build.CommandLine.OutOfProcTaskAppDomainWrapperBase.InstantiateAndExecuteTask(IBuildEngine oopTaskHostNode, LoadedType taskType, String taskName, String taskLocation, String taskFile, Int32 taskLine, Int32 taskColumn, AppDomainSetup appDomainSetup, IDictionary`2 taskParams)   MyProject   

尝试这样做:

  1. 打开构建菜单
  2. 点击清除解决方案
  3. 关闭Visual Studio
  4. 再次打开解决方案
  5. 打开构建菜单
  6. 点击重建

如果还是不行,重启电脑,应该可以解决