"Knowledge has to be improved, challenged, and increased constantly, or it vanishes."

Resolving 'System.Drawing.Image' Errors After Upgrading to .NET 9

Microsoft recently released .NET 9, the latest version of its popular development platform. This release brings several enhancements, including improved performance, enhanced developer productivity tools, and updated runtime features. With a focus on streamlining application development and introducing new capabilities, .NET 9 continues to solidify its position as a powerful framework for modern software development.

Being excited about the new .NET 9 release, I decided to upgrade one of the projects I was working on from .NET Core 8 to .NET 9. However, to my surprise, I encountered the following error while building the application:

The type name 'Image' could not be found in the namespace 'System.Drawing'. This type has been forwarded to assembly 'System.Drawing.Common, Version=0.0.0.0 Consider adding a reference to that assembly.

See the screenshot of the error shown in the Visual Studio.

image

By clicking on the error, I discovered that the following line of code was causing the issue:

System.Drawing.Image img = System.Drawing.Image.FromStream(memoryStream);

At first, I didn’t have a clear idea about what was causing the issue. Searching online didn’t yield much helpful information at the time. After some trial and error, I decided to check the NuGet Package Manager to see if there was a package named System.Drawing.Common, as hinted in the error message.

image

I found the package in the NuGet Package Manager and installed it. To my relief, this resolved the error, and the application started building successfully. The best part? There was no need to modify any existing namespaces or references in my code. Simply adding the System.Drawing.Common package fixed the issue seamlessly.

Summary

The error was caused because .NET 9 does not include the System.Drawing.Common library by default. In previous versions like .NET 8, this library was automatically referenced in certain project templates, allowing developers to use classes like System.Drawing.Image seamlessly. With .NET 9, this behavior has changed, requiring developers to explicitly include the System.Drawing.Common NuGet package when these features are needed.

6 Comments

  • I’ve been using essaypro app recently, and as a student, it has been a real lifesaver. The app is intuitive, making it easy to place orders and communicate with writers directly. The essay I received was high-quality, well-researched, and met all my requirements. I really appreciate how simple the process is, and it has saved me so much time during busy weeks.

  • Upgrading to .NET 9 always comes with surprises, and handling compatibility issues like missing references can be frustrating. When dealing with complex systems, a smooth experience is essential—not just in development but in entertainment as well. For those who appreciate precision and strategy, I’ve found that this site provides an excellent roulette experience. The platform ensures seamless gameplay, fair mechanics, and a variety of options to suit different strategies. Whether you're into classic or live roulette, it’s a reliable choice for a top-tier gaming experience.







  • Usually they don't have many glitches after an update, but sometimes there are some snags

  • Thank you for sharing this helpful information! I recently upgraded to .NET 9 as well, and I faced a similar issue with the System.Drawing.Image class after the upgrade. The error message you encountered was exactly the same. I wasn’t sure what the issue was at first either, but your suggestion to check the NuGet Package Manager for System.Drawing.Common was spot on.

    Once I added the System.Drawing.Common package to my project, everything worked perfectly. It's great to see these issues documented so clearly, as it saves a lot of time for developers troubleshooting after upgrades. Keep up the good work!

  • I didn't think that gambling could be such an interesting pastime, but I accidentally came across Casino https://odds96.in/en/blog/what-is-aviator-game and decided to try it. I made a couple of bets, I thought it would just be fun, but I didn't expect that luck would be on my side! A couple of wins and a quick withdrawal of funds made the evening much more interesting. It was unexpectedly pleasant.

  • I didn't think that gambling could be such an interesting pastime, but I accidentally came across Casino <a href="https://odds96.in/en/blog/what-is-aviator-game">https://odds96.in/en/blog/what-is-aviator-game</a> and decided to try it. I made a couple of bets, I thought it would just be fun, but I didn't expect that luck would be on my side! A couple of wins and a quick withdrawal of funds made the evening much more interesting. It was unexpectedly pleasant.

Add a Comment

As it will appear on the website

Not displayed

Your website