When I open a solution for the first time after it has been downloaded from TFS, it (Vs2010) is unable to find the NuGet.targets file.
I've checked TFS and it's marked as downloaded, and it exists on the file system.
If I try to open the solution directly from TFS again, it suddenly works.
I feel this is the reason why my automated builds are also failing.
Has anyone come across this issue before?
Delete the target and save files. Then right-click the project to reload the project and run a rebuild. I assume you may have such target in your project file (xx.csproj), which tries to find the nuget.targets file, delete the target to check if it helps. Similar issue see here. Show activity on this post. This is issue was resolved quite easily.
Find the .nuget folder in your solution. Inside, locate nuget.Targets, and open the file. 2. Locate a portion of the file that looks like this: <!-- Download NuGet.exe if it does not already exist --> <!--
This project references NuGet package (s) that are missing on this computer. Use NuGet Package Restore to download them. The missing file is {name}. This error occurs when you attempt to build a project that contains references to one or more NuGet packages, but those packages are not presently installed on the computer or in the project.
NuGet pack and restore as MSBuild targets. With the PackageReference format, NuGet 4.0+ can store all manifest metadata directly within a project file rather than using a separate .nuspec file. With MSBuild 15.1+, NuGet is also a first-class MSBuild citizen with the pack and restore targets as described below.
Ran into this Friday and on another machine today.
For the machine on Friday I copied the .nuget directory, since I didn't have one.
For the machine today it had the .nuget directory and copying it from another machine didn't resolve the issue. Opening it from TFS's Source Control Explorer didn't work either.
We then followed the steps on Opening project in Visual Studio fails due to nuget.targets not found error (enable Package Restore on the solution) and it worked without issue.
Hadn't run into this before last week, and it's just one project of many, with none of the others having this problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With