.NET issue GH Plugin macOS

I created a small plugin some time ago with Visual Studio on macOS. Now I opened the Project with VS Code, everything works fine, I can still compile it. But when I want to add a new component with

dotnet new ghcomponent -n "New Component"

I get the following error when I compile the project:

.csproj' failed to build. Would you like to continue and run the last successful build?

The issue seems to be related with

    protected override System.Drawing.Bitmap Icon
        {
            get
            {
                //You can add image files to your project resources and access them like this:
                // return Resources.IconForThisComponent;
                return null;
            }
        }

of the default code of the added component. It works fine, when I comment it out. Interestingly adding standard components works fine when I follow the new VS Code plugin guide for macOS.

My guess is, that there is an issue with the .NET versions…

Can someone help me here? (I dont need Bitmap icons for now, but would be good to understand the issue)

p.s.: this is from the .csproj file:

    <TargetFrameworks>net7.0;net48</TargetFrameworks>