I have cloned Sitecore docker-examples repository and started to go through tutorial of building custom images Building Custom Sitecore images.
I noticed that when I use the command docker-compose build solution, it throws and error about not finding a certain NuGet package:
Error text is below (slightly different than image above but same error).
C:\build\Directory.Build.targets : error : Could not resolve SDK "Microsoft.Build.CentralPackageVersions". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
C:\build\Directory.Build.targets : error : C:\Program Files\dotnet\sdk\7.0.302\Sdks\Microsoft.Build.CentralPackageVersions\Sdk not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.
C:\build\Directory.Build.targets : error : Unable to find package Microsoft.Build.CentralPackageVersions. No packages exist with this id in source(s): nuget.org, Sitecore Feed
C:\build\Directory.Build.targets : error : MSB4276: The default SDK resolver failed to resolve
SDK "Microsoft.Build.CentralPackageVersions" because directory "C:\Program Files (x86)\Microsoft
Visual Studio\2022\BuildTools\MSBuild\Sdks\Microsoft.Build.CentralPackageVersions\Sdk" did not exist.
C:\build\Directory.Build.targets : warning : Unable to load the service index for source https://api.nuget.org/v3/index.json.
C:\build\Directory.Build.targets : warning : Unable to load the service index for source https://sitecore.myget.org/F/sc-packages/api/v3/index.json.
C:\build\Directory.Build.targets : error MSB4236: The SDK 'Microsoft.Build.CentralPackageVersions/2.0.79' specified could not be found. [C:\build\src\Foundation\Search\website\Foundation.Search.csproj]
I did open the example solution on VS2019 and published the project to directory and it works, so does build solution. I checked that the package is indeed in nuget.org, so how come it cannot find it? However, it's not installed to these projects in solution and Package Manager does not allow me to do that, it's only referenced in Directory.Build.targets. Why am I getting this error?
Error is: The SDK 'Microsoft.Buikd.CentralPackageVersions/2.0.79' specified could not be found.