at work we do not use nuget and even though in my personal projects i use it ,i dont understand why many solutions I download all have it,typically with 3 files
Nuget.config,exe and target.
Can somebody explain why people add this folder to their solutions?
thanks
That folder was a key player in NuGet package restore in the good old days (NuGet.targets is the proof). But since the new restore mechanism is in place, only the NuGet.exe is useful.
You might read more from NuGet.org,
https://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore
Update:
The linked article was updated and moved to Microsoft Docs.
MSBuild 15 also adds NuGet package restore support if you read the above carefully.
As of nuget 2.7+, this folder is no longer needed and can be safely deleted. Futhermore, if you use the Visual Studio command line prompt, you should be able to access nuget.exe from there, as well as, within Visual Studio from the Package Manager.
To enable automatic package restore in projects that used nuget 2.6 or before, you might need to manually delete the following from the bottom of your *.csproj files:
<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'))" />
<Error Condition="!Exists('..\..\packages\MSBuildTasks.1.5.0.214\build\MSBuildTasks.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSBuildTasks.1.5.0.214\build\MSBuildTasks.targets'))" />
</Target>
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