Description
Describe the bug
This weekend I was attempting to build a containerized .NET app using the new SDK support. Following the documentation lead to undecipherable msbuild errors. Eventually I had to just add a Dockerfile to my app to make progress.
To Reproduce
Following the official documentation I did roughly the following:
> dotnet new razor
> dotnet add package Microsoft.NET.Build.Containers
> dotnet publish --os linux --arch x64 /t:PublishContainer -c Release
That leads to the following error
C:\Program Files\dotnet\sdk\8.0.100-preview.5.23303.2\Containers\build\Microsoft.NET.Build.Containers.targets(202,21)
: error MSB4064: The "LocalRegistry" parameter is not supported by the "CreateNewImage" task loaded from assembly: Mi
crosoft.NET.Build.Containers, Version=7.0.305.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 from the path: C:\U
sers\jaredpar\.nuget\packages\microsoft.net.build.containers\7.0.305\tasks\net7.0\Microsoft.NET.Build.Containers.dll.
Verify that the parameter exists on the task, the <UsingTask> points to the correct assembly, and it is a settable p
ublic instance property. [C:\Users\jaredpar\temp\Fun\Fun.csproj]
I spent a good 14 minutes trying to debug that error: googling, looking at binlogs and could not make any progress. Eventually I noticed a warning in the output
C:\Program Files\dotnet\sdk\8.0.100-preview.5.23303.2\Sdks\Microsoft.NET.Sdk.Publish\targets\Microsoft.NET.Sdk.Publis
h.targets(191,5): warning : Microsoft.NET.Build.Containers NuGet package is explicitly referenced. Consider removing
the package reference to Microsoft.NET.Build.Containers as it is now part of .NET SDK. [C:\Users\jaredpar\temp\Fun\Fu
n.csproj]
Removing that package got me past the build error.
My suggestion i that this should not be a warning, it should be an error. The actual important message was de-prioritized because it was a warning and I was staring at the actual errors in my project. If there is no expectation this will succeed with .NET 8 installed then that should be an error. Or