6

I'm working with Visual Studio Community 2015 on a Visual Basic application targeting .NET 4.5. I didn't write the application so I added all the missing dependencies using NuGet but there are 3 dependencies I can't add no matter what I try. This is one of the many errors I get when building the project:

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.

This are the dependencies:

  • System.IO
  • System.Runtime
  • System.Threading.Tasks

I tried installing them with NuGet but I get this error for example when trying to install System.IO that also installs System.Runtime and System.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.

I also tried to add them manually adding the .dll that in my case are in:

  • 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

But doesn't work neither. I also tried removing System.Runtime as it says here and the answer here, both without any success.

This is an image of my References:

enter image description here

Community
  • 1
  • 1
Andres
  • 6,080
  • 13
  • 60
  • 110

1 Answers1

0

Me too face this problem. I have resolved this issue by

  1. Removing the bin & obj folder You can use below command to clear your projects bin & obj folders. Open your commend prompt, Go to your project's root director then run below commends
    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
    
  2. Delete the temp files in my machine

To avoid this problem in future, maintain separate folder (DependentAssembly) to store those assemblies. When nuget restore the packages, it will update a new package dll. So, there might be chance to get build error, due to made some changes existing methods in new assemblies. enter image description here

shA.t
  • 16,580
  • 5
  • 54
  • 111
LTA
  • 191
  • 3
  • 16