In this topic
About user-specified directories
Use the Preferences dialog box to add or remove directories for searching customized ArcGIS snippets. The following is a typical workflow for adding a user-specified directory:
- Click Tools and click Options on the ArcGIS Snippet Finder dialog box. See the following screen shot:
- On the Preferences dialog box, click the Directories node. See the following screen shot:
- Select the language for your customized ArcGIS snippet. The available options are CSharp and VBNet.
- Click Add on the Preferences dialog box. The Browse For Folder dialog box appears.
- On the Browse For Folder dialog box, choose a directory that contains your language-specific ArcGIS snippets.
The ArcGIS Snippet Editor allows for the creation of user-specified ArcGIS snippets. By default, the ArcGIS Snippet Finder and the ArcGIS Snippet Editor have a predefined location for user-created ArcGIS snippets, which is %APPDATA%\ESRI\ArcGISSnippets.
For the ArcGIS Snippet Finder, this means that on the Preferences dialog box for the Directories section, the VB .NET and C# languages will have this initial directory already specified under the Location area.
The following shows where the default installation location for user-specified ArcGIS snippets are depending on the Windows operating system you are using:
- Windows XP—C:\Documents and Settings\<user login>\Application Data\ESRI\ArcGISSnippets
- Windows Vista—C:\Users\<user login>\AppData\Roaming\ESRI\ArcGISSnippets
The %APPDATA% environment variable is set by the Windows operating system. To verify your %APPDATA% location, type %APPDATA% in Windows Explorer's Address bar and press Enter.
Adding a searchable directory
Do the following to add a searchable directory:
- Click Add on the Preferences dialog box. The Browse For Folder dialog box appears.
- On the Browse For Folder dialog box, navigate to the location for your customized language-specific ArcGIS snippets.
Removing a searchable directory
Do the following to remove a searchable directory:
- Click the directory path in the Location area on the Preferences dialog box.
- Click Remove.
ArcGIS snippet format
To enable the ArcGIS Snippet Finder dialog box's functionality, additional XML tags were added to the standard Microsoft snippets XML schema. The standard Insert Snippet context menu (via Microsoft Visual Studio code editor) ignores these extra XML tags. ArcGIS snippets are added to Visual Studio's installation directory, typically in the following locations:
- Visual Studio 2008:
- C:\Program Files\Microsoft Visual Studio 9.0\VB\Snippets\ArcObjects
- C:\Program Files\Microsoft Visual Studio 9.0\VC#\Snippets\ArcObjects
The following extra XML tags are included as of ArcGIS 9.3:
[XML] <ArcGISSnippet>
<XMLFormat>9</XMLFormat>
<SnippetVersion></SnippetVersion>
<ParentGUID></ParentGUID>
<Language></Language>
<GUID></GUID>
<Name></Name>
<LongDescription></LongDescription>
<Products>
<Product ProductType=""></Product>
</Products>
<Extensions>
<Extension></Extension>
</Extensions>
<ProductVersions>
<ProductVersion></ProductVersion>
</ProductVersions>
<SnippetType></SnippetType>
<References>
<Reference></Reference>
</References>
<InputParameters>
<Input ParameterType=""></Input>
</InputParameters>
<ReturnParameters>
<Return></Return>
</ReturnParameters>
<Members>
<Member LinkToComponentHelp=""></Member>
</Members>
<CodeBody>
<![CDATA[
]]>
</CodeBody>
</ArcGISSnippet>
Description of XML tags
The following table describes each XML tag in the previous code example:
XML tag |
Description |
<ArcGISSnippet></ArcGISSnippet> |
Parent tag for ArcGIS snippet searching. |
<XMLFormat></XMLFormat> |
ArcGIS Snippet format version. For ArcGIS 9.3 and higher, this is version 9. |
<SnippetVersion></SnippetVersion> |
Version of the individual snippet, which is useful for future changes to the snippet. |
<ParentGUID></ParentGUID> |
Unique ID using a globally unique identifier (GUID) that matches the ArcGIS snippet's name for ESRI provided ArcGIS snippets in the installed .NET ArcObjects software development kit (SDK). The ParentGUID will be the same in the VB .NET and C# versions of the ArcGIS snippet. |
<Language></Language> |
The relevant language (VB and CSharp) for the ArcGIS snippet. |
<GUID></GUID> |
Unique ID using a GUID for each snippet. For ESRI provided ArcGIS snippets with the .NET ArcObjects SDK, the GUID will be different for the VB .NET and C# versions of the same snippet. However, the ParentGUID will always be the same in both languages. |
<Name></Name> |
The snippet's file name. It is the same as what appears in the Microsoft Visual Studio Code Snippet Manager without .snippet appended to the name. |
<LongDescription></LongDescription> |
Long description for what the ArcGIS snippet does. It is the same as what appears in the Microsoft Visual Studio Code Snippet Manager for the description. |
<Products></Products> |
List container for housing zero or more <Product></Product> tags. |
<Product ProductType=""></Product> |
The ArcGIS product this snippet is useful for. Choices are ArcGIS Desktop, ArcGIS Engine, and ArcGIS Server. There is a ProductType attribute tag that must also be set. The available options for the ProductType attribute tag are ArcView, ArcEditor, ArcInfo, Engine, and Server. |
<Extensions></Extensions> |
List container for housing zero or more <Extension></Extension> tags. |
<Extension></Extension> |
ArcGIS extension products that are required for the code in the snippet to work. Examples include ArcGIS Network Analyst and ArcGIS Spatial Analyst. |
<ProductVersions></ProductVersions> |
List container for housing zero or more <ProductVersion></ProductVersion> tags. |
<ProductVersion></ProductVersion> |
Supported ArcGIS products the snippet works in. Currently 9.2, 9.3, 9.3.1, and 10.0 are used; however, more can be added in future releases. |
<SnippetType></SnippetType> |
The ArcGIS snippet type. Valid values are function-sub-method, statements, and other. Function-sub-method snippets are inserted at the root level of a class file; statements snippets are inserted within an existing Sub, Function, or Method, unless otherwise noted; other snippets can be inserted any place in a code file and should be noted in the comments. |
<References></References> |
List container for housing zero or more <Reference></Reference> tags. |
<Reference></Reference> |
Fully qualified assembly names for required references to be added to the Visual Studio project for the snippet to compile in the project. |
<InputParameters></InputParameters> |
List container for housing zero or more <Input></Input> tags. |
<Input ParameterType=""></Input> |
Fully qualified assembly name of input parameter options for Subs, Functions, and Methods or other specified arguments in statements, and other type of ArcGIS snippets. The ParameterType attribute tag must also be set. The available options for the ParameterType attribute tag are ByVal and ByRef. |
<ReturnParameters></ReturnParameters> |
List container for housing zero or more <Return></Return> tags. |
<Return></Return> |
The fully qualified assembly name of return parameter options for Functions and Methods. |
<Members></Members> |
List container for housing zero or more <Member></Member> tags. |
<Member LinkToComponentHelp=""></Member> |
The fully qualified members used within the code. The LinkToComponentHelp attribute tag must also be set. The available options for the LinkToComponentHelp attribute tag are True and False.
LinkToComponentHelp is used internally by ESRI to determine if the ArcGIS snippet should be linked to topics in the Library Reference section of the SDK. |
<CodeBody><![CDATA[]]></CodeBody> |
The body of ArcGIS snippet code. This section includes any inline and XML documentation comments within the code for documentation. |
Creating user-specified ArcGIS snippets
The ArcGIS Snippet Editor allows for the creation of user-specified ArcGIS snippets. While it is possible to create your ArcGIS snippets using an American Standard Code for Information Interchange (ASCII) text editor, it is error prone and tedious. Use the features of the ArcGIS Snippet Editor to create and manage user-specified ArcGIS snippets.
All customizations that are used by the ArcGIS Snippet Finder through the Tools menu Options selection are stored on disk in an XML file named ArcGISSnippetPreferences9.xml. This XML file controls the behavior of the ArcGIS Snippet Finder. The following is the location on disk for this XML file:
- %APPDATA%\ESRI\ArcGISSnippets\Settings\ArcGISSnippetPreferences9.xml
If the ArcGISSnippetPreferences9.xml is deleted, it will be re-created with default settings the next time the ArcGIS Snippet Finder is used.
See Also:
ArcGIS Snippet FinderRefining searches
Code insertion options
ArcGIS Snippet Editor
Overview of the ArcGIS Snippet Editor Manager
Development licensing | Deployment licensing |
---|---|
ArcGIS for Desktop Basic | ArcGIS for Desktop Basic |
ArcGIS for Desktop Standard | ArcGIS for Desktop Standard |
ArcGIS for Desktop Advanced | ArcGIS for Desktop Advanced |
Engine Developer Kit | Engine |