Home
Home copied to clipboard
nanoFramework.UI.Bitmap missing
Tool
Visual Studio extension
Description
Adding Images of the type .bmp , .gif and .jpg as resources make the VS solution uncompilable.
Error CS0234 The type or namespace name 'UI' does not exist in the namespace 'nanoFramework' (are you missing an assembly reference?):


If you play around and practice long enough with deleting and different kinds of adding another error message appears:

The resource System.Drawing was automatically added to the project. Compiling is only possible again once this has been deleted.
How to reproduce
- I am creating a new Blank Application Solution.
- add nanoFramework.ResourceManager as NuGet Package
- add a new Resource File (.NET nanoFramework) to the project
- add some Files (Images: .png, .pcx, .tif and Sound: .wav) to the Resource1.resx (per drag and drop or manuell, makes no difference). The pcx is not recognized as an image (works fine anyway)
- I compile the project. No problem everything perfect.
- Now I add more pictures (.bmp, .gif, .jpg)
- Now the project can no longer be compiled!
My example (before and after the error):
NFImageResscources_working.zip NFImageResscources_notworking.zip
Expected behaviour
- it would be nice if adding a Resource.resx automatically adds the nanoFramework.ResourceManager reference.
- nanoFramework.UI.Bitmap should be available. Or images should be added as normal files (BinaryResources instead of BitmapResources). Nobody wants to edit images in VS, anyway!
Screenshots
No response
Aditional context
Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.4.4 .NET nanoFramework VS Extension v2022.3.0.18
Duplicated of #844
This is the standard behavior. Unfortunately we can't do much about it. This depends on the VS extensibility library and there is no option to extend resources to other languages.
Reference to ResourceManager nuget has to be added manually. Reference to UI has to be added manually if images are being used.
No native support for pcx, so that's handled as a binary resource.
Duplicated of #844
This is the standard behavior. Unfortunately we can't do much about it. This depends on the VS extensibility library and there is no option to extend resources to other languages.
Reference to ResourceManager nuget has to be added manually. Reference to UI has to be added manually if images are being used.
No native support for pcx, so that's handled as a binary resource.
No the problem is not the manual adding. The problem is the fact that nanoFramework.UI.Bitmap does not exist in nanoFramework.System.Drawing.
And there is no option to add a jpg or gif to a nanoFramework Project.
I got lost on your explanation. I see... that's probably in the resource processing task....
@josesimoes thank you :-)
I loaded up your [NFImageResscources_working.zip] In this project I didn't see a reference to the graphics library. Bitmaps types and namespaces are supported by the graphics nuget not by the resource manager. You need both resource manager and graphics references.
Does this answer your question?
no, the whole thing is not a question, it is the explanation of what exactly is missing. Someone has to write the code for nanoFramework.UI.Bitmap. Without this code .bmp, .gif, .jpg will not work.
Maybe it can just be a dummy class. Or it is very difficult. I don't know it.
The code for nanoFramework.UI.Bitmap. is already written.
nanoFramework.Graphics/Bitmap.cs at main · nanoframework/nanoFramework.Graphics · GitHubhttps://github.com/nanoframework/nanoFramework.Graphics/blob/main/nanoFramework.Graphics/Primitive/Bitmap.cs
Sent from Outlookhttp://aka.ms/weboutlook From: Dave Schmid @.> Sent: Friday, June 2, 2023 4:45 PM To: nanoframework/Home @.> Cc: TerryFogg @.>; Comment @.> Subject: Re: [nanoframework/Home] nanoFramework.UI.Bitmap missing (Issue #1217)
no, the whole thing is not a question, it is the explanation of what exactly is missing. Someone has to write the code for nanoFramework.UI.Bitmap. Without this code .bmp, .gif, .jpg will not work.
— Reply to this email directly, view it on GitHubhttps://github.com/nanoframework/Home/issues/1217#issuecomment-1573235389, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC6P4K57VWRGLOWU6TOHXQTXJGDWRANCNFSM6AAAAAAUFGFNQU. You are receiving this because you commented.Message ID: @.@.>>
Ok, with the nuget nanoFramework.Graphics I can now compile but unfortunately not upload it to the device. This message appears: [The connected target does not have support for nanoFramework.Graphics.] But I don't want to edit the graphic on the device, I just want to upload the resource to the device. I actually only need the part of nanoFramework.Graphics for the ResourceManager in VisualStudio.
You need this firmware to use graphics. The first one is for REV0 hardware and the the second one is for REV3 hardware with PSRAM.
ok, that's cool but i don't want any graphic support on the device, i just want to upload a jpg for the web server.
You can do the following I think, not near a computer at the moment. Change the extension of your graphics to .dat or something, the software automatically adds template code based on extension type, .dat should not need graphics reference.
On 2 Jun 2023, at 5:42 pm, Dave Schmid @.***> wrote:
Ok, with the nuget nanoFramework.Graphics I can now compile but unfortunately not upload it to the device. This message appears: [The connected target does not have support for nanoFramework.Graphics.] But I don't want to edit the graphic on the device, I just want to upload the resource to the device. I actually only need the part of nanoFramework.Graphics for the ResourceManager in VisualStudio.
— Reply to this email directly, view it on GitHubhttps://github.com/nanoframework/Home/issues/1217#issuecomment-1573298912, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC6P4K67WKMHAPFMC3MX7FDXJGKOXANCNFSM6AAAAAAUFGFNQU. You are receiving this because you commented.Message ID: @.***>
Unfortunately, this workaround doesn't work either. It seems that the VisualStudio ResourceManager dialog parses the files somehow. He notices that it is a graphics file. No matter what file extension.
oh, i found a way! It works with .txt Text File.
The whole thing is a bit ugly but this way it works.
It would be good to have a clean solution.