Search code examples
c#.netvisual-studiobitmapresources

How to add Bitmaps to my project in Visual Studio Community (post Jun 2024 Update)


I have been developing a C# project for a few months now and using the resource manager to add bitmaps to my app. Before the June 2024 update (which introduced a new layout for the resource manager), I could simply drag and drop a .png into the resource manager window and VS would add it as a bitmap. I would then add the image as a glyph using a .ToBitmapSource() method.

Since the update, I cannot add a .png as a bitmap, they are automatically as a System.Byte object.

Any idea on how to add a bitmap ?

Many thanks !

Tried adding different image formats (.png, .jpg, .ico, etc.). Tried forcing it as bitmap in the Resources.Designer.cs


Solution

  • This can be fixed by reverting back to the legacy resource editor and you can add images as System.Drawing.Bitmap instead of System.Byte[]. Here are the specific steps:

    1. Right-click on the .resx file in Solution Explorer and select "Open With...".

    2. In the dialog box that pops up, select Managed Resources Editor (Legacy).

    3. Click "Set as Default" to make it the default asset editor, avoiding to manually select it every time.