-1

I just downloaded the current revision from TFS. However even after restoring the nuget packages it isn't building. Something about missing Nugets.

Any assistance would be appreciated. Is this because we are using different Visual studio versions?

I'm opening the csproj file to build my sln file.

Pug
  • 103
  • 1
  • 1
  • 8

1 Answers1

0

Try following below steps to fix that:

  1. Close Visual Studio
  2. Manually delete the local “packages” folder
  3. Reopen the solution, and rebuild. (Nuget should restore the packages)

Source Link: Missing Nuget Packages on TFS Build Server

Or run the update-package -reinstall command in NuGet Package Management Console to reinstall all referenced packages.


If that still not work, just try this:

Right click on .csproj and open it in notepad or any editor and delete the following

<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>

Then build your solution and it should work.

And this thread for your reference: NuGet not restoring packages on build

Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55
  • Turns out the other team member changed the path to the nugets. So even after properly restoring them I had to edit the path in the csproj file to get it to build. – Pug Oct 18 '17 at 14:46
  • I also had to run update-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r in tools>package manager console afterwards to clean up the Roslyn bin issue. – Pug Oct 18 '17 at 15:44