0

I'm trying to add to my WinUI 3 application (.NET6) some icons from Visual Studio 2022 Image Library.
I tried following the guide for WPF (https://learn.microsoft.com/en-us/visualstudio/extensibility/image-service-and-catalog?view=vs-2022#how-do-i-write-new-wpf-ui) by using CrispImage, but the library Microsoft.VisualStudio.Imaging is only available for .NETFramework, so I have encountered some compatibility issues.

I imported the libraries:

xmlns:imaging="using:Microsoft.VisualStudio.Imaging"
xmlns:catalog="using:Microsoft.VisualStudio.ImageCatalog"

And then I created my control:

<imaging:CrispImage Width="16" Height="16" Moniker="{StaticResource catalog:KnownMonikers.MoveUp}"/>

But I cannot compile anymore, it says:

WMC1006 Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: Microsoft.VisualStudio.Utilities, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.'

I think it is because Microsoft.VisualStudio.Imaging is targeted to .NETFramework, but I cannot find any corresponding for .NET6.
Any suggestion?

Gio
  • 1
  • 1
  • "I have encountered some compatibility issues" is far too vague. Detail the exact issues, show some code, etc https://stackoverflow.com/help/minimal-reproducible-example – Simon Mourier Aug 04 '22 at 08:48
  • I edited my question, is it better now? – Gio Aug 04 '22 at 09:59
  • These assemblies are just supposed to be loaded in a Visual Studio context. Are you trying to build an extension to Visual Studio using WinUI3? – Simon Mourier Aug 04 '22 at 10:15
  • I'm not sure I understand what you mean by saying 'build an extension to Visual Studio using WinUI3'. I'm just trying to use an icon from Visual Studio 2022 Image Library without having to include its .svg as resource within my project. – Gio Aug 04 '22 at 10:30
  • The article and dlls are only usable in the context of Visual Studio extensibility, they're not for general use (plus you can't legally redistribute Visual Studio dll). CrispImage is a WPF only control (can't use it in WinUI3), and even from pure Win32 (https://learn.microsoft.com/en-us/visualstudio/extensibility/image-service-and-catalog?view=vs-2022#how-do-i-update-win32-ui), you would need to query for the SID_SVsImageService which is available only from a Visual Studio context (usually means in-process with Visual Studio, loaded by Visual Studio) – Simon Mourier Aug 04 '22 at 10:53
  • Oh... I get it. So I am not allowed to use their icons for my application? Great, thanks for the help! – Gio Aug 04 '22 at 10:58

1 Answers1

0

I have managed to use Image Library in my code without an error, but get only to the point where I see only blank object while adding imagecrisp to my WPF app.

According to EULA you can freely use Image Library. Main requirement is to use icons according to their description. Database icon for database etc... Besides it, EULA does not even restrict selling software with use of Image Library. That's on @Simon Mourier's comment.

Image library extension is compatible with net6.0. You just probably need to change Target OS version of your project.

In the solution explorer right click on your project -> properties -> Application -> General. Change Target OS Version and Supported OS version to windows 10. I have 10.0.22621.0.

Then rebuild your solution.

PS: Maybe I have to "Manifest from resources" next to make images from my catalog visible. Not sure how to do that... https://learn.microsoft.com/en-us/visualstudio/extensibility/internals/manifest-from-resources?view=vs-2022