Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget.targets not found on first time solution opening

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?

like image 944
Stuart.Sklinar Avatar asked May 10 '12 11:05

Stuart.Sklinar


People also ask

How to fix NuGet target is not working?

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.

How do I install NuGet on my solution?

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

Why is my NuGet package missing from my project?

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.

Can NuGet pack and restore as MSBuild targets?

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.


1 Answers

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.

like image 197
James Skemp Avatar answered Oct 12 '22 23:10

James Skemp