Open elachlan opened 2 years ago
I tried quickly to add FromBitmap
and FromMetafile
via a template. I got compile errors in the generated code around the global::System.Drawing.Bitmap
and global::System.Drawing.Imaging.Metafile
with the types not being available in the namespace.
I got compile errors in the generated code ... with the types not being available
I'm guessing because the compilation would have to reference System.Drawing.dll to resolve those types. We may need to suppress using that template for compilations that do not already reference System.Drawing.
@AArnott Do you have any examples of suppressing a template for compilations without certain references?
Nothing for templates, no. I did recently add something so that templates can reference other metadata types and have that automatically trigger generation of those referenced types. So if you wanted to build on that to say that if the referenced types are not in the metadata and are not referenced otherwise to just skip the template, that sounds good to me.
These static functions below are in winforms.
FromIcon
might be hard without a method to resolve dependencies added from templates.Winforms Tracking: https://github.com/dotnet/winforms/issues/7468