Skip to content

Commit 74b4de5

Browse files
Merge pull request #12950 from maiak/asarratori_update
Add information to the imaging docs related to properly handling strongly named assemblies
2 parents 1188f75 + 846f118 commit 74b4de5

File tree

3 files changed

+55
-23
lines changed

3 files changed

+55
-23
lines changed

docs/extensibility/image-service-and-catalog.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Image Service and Catalog
33
description: This article contains guidance and best practices for adopting the Visual Studio Image Service and Image Catalog.
4-
ms.date: 04/01/2019
4+
ms.date: 08/21/2024
55
ms.topic: conceptual
66
author: maiak
77
ms.author: maiak
@@ -92,6 +92,8 @@ This cookbook contains guidance and best practices for adopting the Visual Studi
9292
<Guid Name="ShellCommandGuid" Value="8ee4f65d-bab4-4cde-b8e7-ac412abbda8a" />
9393
<ID Name="cmdidSaveAll" Value="1000" />
9494
<String Name="AssemblyName" Value="Microsoft.VisualStudio.Shell.UI.Internal" />
95+
<!-- If your assembly is strongly named, you'll need the version and public key token as well -->
96+
<!-- <String Name="AssemblyName" Value="Microsoft.VisualStudio.Shell.UI.Internal;v17.0.0.0;b03f5f7f11d50a3a" /> -->
9597
</Symbols>
9698
```
9799

@@ -682,6 +684,32 @@ b714fcf7-855e-4e4c-802a-1fd87144ccad,2,fda30684-682d-421c-8be4-650a2967058e,200
682684

683685
- Set "Include in VSIX" to True.
684686

687+
- My images are still not working, how do I figure out what's wrong?
688+
689+
- Visual Studio may not be finding your image manifest. For performance reasons Visual Studio limits folder search depth, so it's recommended that the image manifest be kept in the root folder of your extension.
690+
691+
- You might be missing assembly information in your image manifest file. Assemblies that are strongly named require additional information in order to be loaded by Visual Studio. In order to load a strongly named assembly, you need to include (in addition to the assembly name) the assembly version and public key token in the resource URIs for the images in your image manifest.
692+
```xml
693+
<ImageManifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/VisualStudio/ImageManifestSchema/2014">
694+
<Symbols>
695+
<String Name="Resources" Value="/Microsoft.VisualStudio.Shell.UI.Internal;v17.0.0.0;b03f5f7f11d50a3a;Component/Resources" />
696+
...
697+
</Symbols>
698+
...
699+
</ImageManifest>
700+
```
701+
- You may be missing a codebase entry for your image assembly. If your assembly is not yet loaded by the time Visual Studio needs it, it will need to know where to find your assembly in order to load it. To add a codebase for your assembly, you can use the ProvideCodeBaseAttribute to ensure a codebase entry is generated and included in your extension's pkgdef.
702+
```csharp
703+
[assembly: ProvideCodeBase(AssemblyName = "ClassLibrary1", Version = "1.0.0.0", CodeBase = "$PackageFolder$\\ClassLibrary1.dll")]
704+
```
705+
- If the previous options do no resolve your image load issue, you can enable logging by dropping the following entries into a pkgdef in your extension:
706+
```
707+
[$RootKey$\ImageLibrary]
708+
"TraceLevel"="Verbose"
709+
"TraceFilename"="ImageLibrary.log"
710+
```
711+
This will create a log file called ImageLibrary.log in your %UserProfile% folder. Make sure to run "devenv /updateConfiguration" from a developer command prompt after adding these entries to a pkgdef. This ensures that the logging entries are enabled and that VS refreshes the image manifest cache to help find any errors that may occur when reading your image manifest. If you then run through the scenario where your image is expected to load, your log file will contain both the registration logging and request logging for your image.
712+
685713
- I am updating my CPS Project System. What happened to **ImageName** and **StockIconService**?
686714

687715
- These were removed when CPS was updated to use monikers. You no longer need to call the **StockIconService**, just pass the desired **KnownMoniker** to the method or property using the **ToProjectSystemType()** extension method in the CPS utilities. You can find a mapping from **ImageName** to **KnownMonikers** below:
@@ -751,7 +779,7 @@ b714fcf7-855e-4e4c-802a-1fd87144ccad,2,fda30684-682d-421c-8be4-650a2967058e,200
751779
|ImageName.CSharpCodeFile|KnownImageIds.CSFileNode|
752780
|ImageName.VisualBasicCodeFile|KnownImageIds.VBFileNode|
753781

754-
- I am updating my completion list provider. What **KnownMonikers** match to the old **StandardGlyphGroup** and **StandardGlyph** values?
782+
- I am updating my completion list provider. What **KnownMonikers** match to the old **StandardGlyphGroup** and **StandardGlyph** values?
755783

756784
|Name|Name|Name|
757785
|-|-|-|

docs/extensibility/internals/image-library-viewer.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Image Library Viewer
33
description: Learn about the Visual Studio Image Library Viewer tool that loads and searches image manifests, allowing you to view and manipulate image attributes.
4-
ms.date: 11/04/2016
4+
ms.date: 08/21/2024
55
ms.topic: reference
66
author: maiak
77
ms.author: maiak
@@ -59,6 +59,8 @@ A complete image manifest looks like this:
5959
<Guid Name="ShellCommandGuid" Value="8ee4f65d-bab4-4cde-b8e7-ac412abbda8a" />
6060
<ID Name="cmdidSaveAll" Value="1000" />
6161
<String Name="AssemblyName" Value="Microsoft.VisualStudio.Shell.UI.Internal" />
62+
<!-- If your assembly is strongly named, you'll need the version and public key token as well -->
63+
<!-- <String Name="AssemblyName" Value="Microsoft.VisualStudio.Shell.UI.Internal;v17.0.0.0;b03f5f7f11d50a3a" /> -->
6264
</Symbols>
6365
```
6466

docs/extensibility/internals/manifest-from-resources.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Manifest from Resources
33
description: Learn how to use the Manifest from Resources tool to add .png or .xaml files to an .imagemanifest file for use with the Visual Studio Image Service.
4-
ms.date: 11/04/2016
4+
ms.date: 08/21/2024
55
ms.topic: reference
66
author: maiak
77
ms.author: maiak
@@ -10,7 +10,7 @@ ms.subservice: extensibility-integration
1010
---
1111
# Manifest from Resources
1212

13-
The Manifest from Resources tool is a console application that takes a list of image resources (.png or .xaml files) and generates an .imagemanifest file that allows those images to be used with the Visual Studio Image Service. Additionally, this tool can be used to add images to an existing .imagemanifest. This tool is useful for adding high-DPI and theming support for images to a Visual Studio extension. The generated .imagemanifest file should be included in and deployed as a part of a Visual Studio extension (.vsix).
13+
The Manifest from Resources tool is a console application that takes a list of image resources (.png or .xaml files). Using that list, it generates an .imagemanifest file that allows those images to be used with the Visual Studio Image Service. Additionally, this tool can be used to add images to an existing .imagemanifest. This tool is useful for adding high-DPI and theming support for images to a Visual Studio extension. The generated .imagemanifest file should be included in and deployed as a part of a Visual Studio extension (.vsix).
1414

1515
## How to use the tool
1616
**Syntax**
@@ -21,45 +21,47 @@ The Manifest from Resources tool is a console application that takes a list of i
2121

2222
|**Switch name**|**Notes**|**Required or Optional**|
2323
|-|-|-|
24-
|/resources|A semicolon-delimited list of images or directories. This list should always contain the full list of images that will be in the manifest. If only a partial list is given, the entries not included will be lost.<br /><br /> If a given resource file is an image strip, the tool will split it into separate images before adding each subimage to the manifest.<br /><br /> If the image is a .png file, we recommended you format the name like this so that the tool can fill in the right attributes for the image: \<Name>.\<Width>.\<Height>.png.|Required|
25-
|/assembly|The name of the managed assembly (not including the extension), or the runtime path of the native assembly that hosts the resources (relative to the manifest's runtime location).|Required|
26-
|/manifest|The name to give to the generated .imagemanifest file. This can also include an absolute or relative path to create the file in a different location. The default name matches the assembly name.<br /><br /> Default: \<Current Directory>\\<Assembly\>.imagemanifest|Optional|
24+
|/resources|A semicolon-delimited list of images or directories. This list should always contain the full list of images that will be in the manifest. If only a partial list is given, the entries not included will be lost.<br /><br /> If a given resource file is an image strip, the tool splits it into separate images before adding each subimage to the manifest.<br /><br /> If the image is a .png file, we recommended you format the name like this so that the tool can fill in the right attributes for the image: \<Name>.\<Width>.\<Height>.png.|Required|
25+
|/assembly|The name of the managed assembly (not including the extension), or the runtime path of the native assembly that hosts the resources (relative to the manifest's runtime location). Additionally, if the assembly is strongly named, this entry should include the assembly version and public key token.|Required|
26+
|/manifest|The name to give to the generated .imagemanifest file. This can also include an absolute or relative path to create the file in a different location. The default name matches the assembly name. Additionally, when providing the extra strong name information in the /assembly switch, this switch should be supplied with a user friendly manifest name so that the assembly strong name information isn't included in the manifest name. <br /><br /> Default: \<Current Directory>\\<Assembly\>.imagemanifest|Optional|
2727
|/guidName|The name to give to the GUID symbol for all of the images in the generated manifest.<br /><br /> Default: AssetsGuid|Optional|
2828
|/rootPath|The root path that needs to be stripped off before creating managed resource URIs. (This flag is to help with cases where the tool gets the relative URI path wrong, causing resources to fail to load.)<br /><br /> Default: \<Current Directory>|Optional|
29-
|/recursive|Setting this flag tells the tool to recursively search any directories in the /resources argument. Omitting this flag will result in a top-level-only search of directories.|Optional|
30-
|/isNative|Set this flag when the assembly argument is a path for a native assembly. Omit this flag when the assembly argument is the name of a managed assembly. (See the Notes section for additional information about this flag.)|Optional|
29+
|/recursive|Setting this flag tells the tool to recursively search any directories in the /resources argument. Omitting this flag results in a top-level-only search of directories.|Optional|
30+
|/isNative|Set this flag when the assembly argument is a path for a native assembly. Omit this flag when the assembly argument is the name of a managed assembly. (For more information about this flag, see the Notes section.)|Optional|
3131
|/newGuids|Setting this flag tells the tool to create a new value for the images' GUID symbol instead of merging the one from the existing manifest.|Optional|
3232
|/newIds|Setting this flag tells the tool to create new ID symbol values for every image instead of merging values from the existing manifest.|Optional|
3333
|/noLogo|Setting this flag stops product and copyright information from printing.|Optional|
34-
|/?|Print out Help information.|Optional|
35-
|/help|Print out Help information.|Optional|
34+
|/?|Prints Help information.|Optional|
35+
|/help|Prints out Help information.|Optional|
3636

3737
**Examples**
3838

39-
- ManifestFromResources /resources:D:\Images /assembly:My.Assembly.Name /isNative
39+
- ManifestFromResources /resources:D:\Images /assembly:My.Assembly.Name /isNative
4040

41-
- ManifestFromResources /resources:D:\Images\Image1.png;D:\Images\Image1.xaml /assembly:My.Assembly.Name /manifest:MyImageManifest.imagemanifest
41+
- ManifestFromResources /resources:D:\Images\Image1.png;D:\Images\Image1.xaml /assembly:My.Assembly.Name /manifest:MyImageManifest.imagemanifest
4242

43-
- ManifestFromResources /resources:D:\Images\Image1.png;D:\Images\Image1.xaml /assembly:My.Assembly.Name /guidName:MyImages /newGuids /newIds
43+
- ManifestFromResources /resources:D:\Images\Image1.png;D:\Images\Image1.xaml /assembly:My.Assembly.Name;v1.0.0.0;abcdef0123456789 /manifest:MyImageManifest.imagemanifest
44+
45+
- ManifestFromResources /resources:D:\Images\Image1.png;D:\Images\Image1.xaml /assembly:My.Assembly.Name /guidName:MyImages /newGuids /newIds
4446

4547
## Notes
4648

47-
- The tool only supports .png and .xaml files. Any other image or file types will be ignored. A warning is generated for all unsupported types encountered while parsing the resources. If no supported images are found when the tool is finished parsing the resources, an error will be generated
49+
- The tool only supports .png and .xaml files. Any other image or file types are ignored. A warning is generated for all unsupported types encountered while parsing the resources. If no supported images are found when the tool is finished parsing the resources, an error is generated
4850

49-
- By following the suggested format for .png images, the tool will set the size/dimension value for the .png to the format-specified size, even if it differs from the image's actual size.
51+
- Following the suggested format for .png images results in the tool setting the size/dimension value for the .png to the format-specified size, even if it differs from the image's actual size.
5052

5153
- The width/height format can be omitted for .png images, but the tool will read the image's actual width/height and use those for the image's size/dimension value.
5254

53-
- Running this tool on the same image strip multiple times for the same .imagemanifest will result in duplicate manifest entries, because the tool attempts to split the image strip into standalone images and add those to the existing manifest.
55+
- Running this tool on the same image strip multiple times for the same .imagemanifest will result in duplicate manifest entries. This outcome is because the tool attempts to split the image strip into standalone images and then add those to the existing manifest.
5456

55-
- Merging (omitting /newGuids or /newIds) should only be done for tool-generated manifests. Manifests that have been customized or generated through other means might not be merged correctly.
57+
- Merging (omitting /newGuids or /newIds) should only be done for tool-generated manifests. Manifests that are customized or generated through other means might not be merged correctly.
5658

57-
- Manifests that are generated for native assemblies might need to be hand-edited after generation to make the ID symbols match the resource IDs from the native assembly's .rc file.
59+
- Manifests generated for native assemblies might need to be hand-edited after generation to make the ID symbols match the resource IDs from the native assembly's .rc file.
5860

5961
## Sample Output
6062
**Simple image manifest**
6163

62-
An image manifest will be similar to this .xml file:
64+
An image manifest resembles this .xml file:
6365

6466
```xml
6567
<?xml version="1.0" encoding="utf-8"?>
@@ -85,7 +87,7 @@ The Manifest from Resources tool is a console application that takes a list of i
8587

8688
**Image manifest for an image strip**
8789

88-
An image manifest for an image strip will be similar to this .xml file:
90+
An image manifest for an image strip is similar to this .xml file:
8991

9092
```xml
9193
<?xml version="1.0" encoding="utf-8"?>
@@ -122,7 +124,7 @@ The Manifest from Resources tool is a console application that takes a list of i
122124

123125
**Image manifest for native assembly image resources**
124126

125-
An image manifest for native images will be similar to this .xml file:
127+
An image manifest for native images is similar to this .xml file:
126128

127129
```xml
128130
<?xml version="1.0" encoding="utf-8"?>

0 commit comments

Comments
 (0)