Solution Explorer icons not working
manuelxmarquez opened this issue · comments
I have a project with custom solution explorer icons that stopped working in VS2022. I followed the guide but it no longer works.
If I set the icon using propertyValues.Icon = KnownMonikers.CSProjectNode.ToProjectSystemType();
it works, but not for custom icons.
I verified my icons are included in the assembly with ILSpy and even used the following code:
var imageService = ServiceProvider.GetService(typeof(SVsImageService)) as IVsImageService2;
var resource = new BitmapImage(new Uri(@"file:///F:/Test.png"));
var img = Microsoft.Internal.VisualStudio.PlatformUI.WpfPropertyValue.CreateIconObject(resource);
var imgHandle = imageService.AddCustomImage(img);
var moniker = imgHandle.Moniker;
propertyValues.Icon = new ProjectImageMoniker(moniker.Guid, moniker.Id);
But it still shows blank.
What are the new steps to get this working?
I managed to fix the issue by adding the ProvideBindingPath
attribute to the Package.
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[Guid(Constants.PackageGuid)]
[ProvideBindingPath] // Fixes icons.
internal sealed class ProjectPackage : AsyncPackage
{
}
@manuelxmarquez I try it, but my problem is not resolved, all of my information is https://stackoverflow.com/q/75481734/1539100 , did you have any other idea?