Ce projet référence des packages NuGet manquants sur cet ordinateur

Ce projet référence des packages NuGet manquants sur cet ordinateur

Dans mon cas, j’ai dû supprimer les lignes suivantes du fichier .csproj :

<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'))" />
</Target>

En fait, dans cet extrait, vous pouvez voir d’où provient le message d’erreur.

Je convertissais de MSBuild-Integrated Package Restore vers Automatic Package Restore (https://learn.microsoft.com/en-us/nuget/consume-packages/package-restore#migrate-to-automatic-package-restore)