Rectangle 27 0

visual studio 2010 This project references NuGet package(s) that are missing on this computer?


<add key="repositoryPath" value="..\..\Packages" />

I believe it could be a path issue since I did move the location of the files but I don't see where there is a hard coded path anywhere. I looked in the proj file and all the packages files seem to be relative like this: <Reference Include="Antlr3.Runtime, Version=3.5.0.2, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath> </Reference>

If they are different it could be caused by the packages now being restored to a different location. This could be caused by a NuGet.Config file being checked in specifying a node like this:

Is it possible that the packages have been restored to the wrong folder? Check that the paths in the csproj files are correct.

The packages are being restored, by the projects are still looking at the old location.

You don't want to add that to the web.config. I was referring to the NuGet.config file and you want to check the relative path. Where are your packages relative to the csproj files? Are they in ..\packages? It sounds like the packages are being restored correctly, but your projects are looking in the wrong place.

adding this to web.config did not help: <add key="repositoryPath" value="..\..\Packages" />

Note
Rectangle 27 0

visual studio 2010 This project references NuGet package(s) that are missing on this computer?


<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
   <Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="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." HelpKeyword="BCLBUILD2001" />
    <Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
  </Target>
<Import Project="..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
  <Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
    <Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="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." HelpKeyword="BCLBUILD2001" />
    <Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />

And the build was working again.

In my case it had to do with the Microsoft.Build.Bcl version. My nuget package version was 1.0.21, but my project files were still pointing to version 1.0.14

Note
Rectangle 27 0

visual studio 2010 This project references NuGet package(s) that are missing on this computer?


In 1.0.21 version no files in package, installation of 1.0.14 version fixed this.

This worked for me as well - but I have no idea whether the right thing to do was install that package (which has the same effect as henkie14's version changing answer below or just delete all those Targets - are they actually doing anything useful?

Note
Rectangle 27 0

visual studio 2010 This project references NuGet package(s) that are missing on this computer?


(P.S: Ensure that you have the Nuget Install From Tools--> Extensions and Update--> Nuget Package Manager for Visual Studio 2013. If not install this extention first)

@CantrianBear Navigate to this page docs.nuget.org/consume/package-restore and find the section called MSBuild-Integrated Package Restore. That is the old way and it lists some reasons why you should use the new way.

@TheMuffinMan: Can you please clarify what the new way is and why this way should be avoided (considering that VS 2013 error output tells you to do exactly that)?

I easily solve this problem by right clicking on my solution and then clicking on the Enable NuGet Package Restore option

This is the old way of restoring nuget packages and should be avoided.

Note
Rectangle 27 0

visual studio 2010 This project references NuGet package(s) that are missing on this computer?


<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Import Project="packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
.csproj

(Note the change from ..\packages\ to packages\. It might be a different relative structure in your case, but you get the idea.)

@Simon_Weaver the position of your .csproj relative to your .sln does not matter in this context. What matters is whether anything that is referenced in your .csproj had moved somewhere else. If so, then you need to fix it. If you moved your '.csproj' with everything that it references intact, but kept your .sln where it was, then you'd have to fix the .sln file to the new location of .csproj-es, but there would be no need to edit .csproj files.

I had a similar issue, but really weird. I was using it in a subsolution module, so it was fine in that solution, but when I referenced that solution from another solution, the packages were in a different place. I changed ..\packages to $(SolutionDir)packages throughout the .csproj and that fixed it.

If you don't want to muck around with the .csproj file manually I've found that taking a note of all the nuget packages you have installed for the project, deleting them and reinstalling them resolved this issue for me. I was trying to remove a project from a solution to put into its own git repository when I ran into this issue.

In my case it happened after I moved my solution folder from one location to another, re-organized it a bit and in the process its relative folder structure changed.

Similar issue....I had moved the .csproj file up a level in the directory structure and had to change from "..\..\packages\..." to "..\packages\...".

does this mean your .csproj is at the same level as your .sln file?

Note
Rectangle 27 0

visual studio 2010 This project references NuGet package(s) that are missing on this computer?


<add key="repositoryPath" value="..\..\Packages" />

I believe it could be a path issue since I did move the location of the files but I don't see where there is a hard coded path anywhere. I looked in the proj file and all the packages files seem to be relative like this: <Reference Include="Antlr3.Runtime, Version=3.5.0.2, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath> </Reference>

If they are different it could be caused by the packages now being restored to a different location. This could be caused by a NuGet.Config file being checked in specifying a node like this:

Is it possible that the packages have been restored to the wrong folder? Check that the paths in the csproj files are correct.

The packages are being restored, by the projects are still looking at the old location.

You don't want to add that to the web.config. I was referring to the NuGet.config file and you want to check the relative path. Where are your packages relative to the csproj files? Are they in ..\packages? It sounds like the packages are being restored correctly, but your projects are looking in the wrong place.

adding this to web.config did not help: <add key="repositoryPath" value="..\..\Packages" />

Note
Rectangle 27 0

visual studio 2010 This project references NuGet package(s) that are missing on this computer?


This worked for me as well - but I have no idea whether the right thing to do was install that package (which has the same effect as henkie14's version changing answer below or just delete all those Targets - are they actually doing anything useful?

Note
Rectangle 27 0

visual studio 2010 This project references NuGet package(s) that are missing on this computer?


<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
  <PropertyGroup>
    <ErrorText>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=322105. The missing file is {0}.</ErrorText>
  </PropertyGroup>
  <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>

In fact, in this snippet you can see where the error message is coming from.

In my case, I had to remove the following from the .csproj file:

OK9999, at one point, you must have enabled it from an earlier version of Visual Studio, by right clicking on the solution and choosing "Enable NuGet package restore" which did it the old way. We don't need that anymore

Thank you very much. For Empty Website Projects this is a must, to get the project up-and-running again after "Nuget Packages are missing".

Thanks, finally an answer that contains all the lines that need to be deleted. Took me many hours. If you have a solution that contains multiple projects, then the error message row contains the name of the project where you should apply this.

This worked for me, but I only needed to remove the <Target></Target> element. VS[2013] seemed to restore it if I removed the <Import> element as well.

if this can be removed, why is it there at the first place?

Note
Rectangle 27 0

visual studio 2010 This project references NuGet package(s) that are missing on this computer?


<RestorePackages>true</RestorePackages>  
...
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />  
...
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">  
    <PropertyGroup>
        <ErrorText>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=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>

If you are not using TFS

If you are using TFS

Edit each project file (e.g., .csproj, .vbproj) in the solution and remove any references to the NuGet.targets file. Open the project file(s) in the editor of your choice and remove the following settings:

Remove the .nuget folder from your solution. Make sure the folder itself is also removed from the solution workspace.

Remove the NuGet.exe and NuGet.targets files from the solution's .nuget folder. Make sure the files themselves are also removed from the solution workspace. Retain the NuGet.Config file to continue to bypass adding packages to source control.

Note
Rectangle 27 0

visual studio 2010 This project references NuGet package(s) that are missing on this computer?


<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
  <PropertyGroup>
    <ErrorText>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=322105. The missing file is {0}.</ErrorText>
  </PropertyGroup>
  <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
  • Remove the part from the file. Save.

One solution would be to remove from the .csproj file the following:

Thank you for this... This worked for me. I did not have to remove the <Import> but just the <Target Name="EnsureNugetPackageBuildImports" ...>

Note