active-directory-dotnet-graphapi-console icon indicating copy to clipboard operation
active-directory-dotnet-graphapi-console copied to clipboard

Can't restore NuGets - NuGet packages missing

Open nrogoff opened this issue 8 years ago • 4 comments

Can't build solution as checked in. Get following error:

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 D:\GitRepos\active-directory-dotnet-graphapi-console\.nuget\NuGet.targets. GraphConsoleAppV3 D:\GitRepos\active-directory-dotnet-graphapi-console\GraphConsoleAppV3\GraphConsoleAppV3.csproj 94

nrogoff avatar Feb 24 '17 11:02 nrogoff

Solution is to remove the following lines from the csproj file (after unloading) and rebuild.

<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>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />

nrogoff avatar Feb 24 '17 11:02 nrogoff

This fix works great. These lines are obviously not needed for Visual Studio 2015, wondering if they are needed for Visual Studio 2013 O.o ?

kiewic avatar Aug 15 '17 15:08 kiewic

Works ... Thank You

RajivGoaple avatar Sep 28 '18 04:09 RajivGoaple

Worked like a charm!

  1. Unload Project
  2. Edit .csproj in Visual Studio and remove ALL the lines specified above
  3. Reload Project

natasha-zz avatar Nov 09 '18 18:11 natasha-zz