This document is archived and information here might be outdated.  Recommended version.


References option for the ArcGIS Snippet Editor (ArcObjects .NET 10.4 SDK)

References option for the ArcGIS Snippet Editor


Summary
The ArcGIS Snippet Editor uses a series of dialog boxes to create ArcGIS snippets. Use the References - ArcGIS Snippet Editor dialog box to choose which .NET assemblies are necessary for your ArcGIS snippet.

In this topic


About the ArcGIS Snippet Editor references option

The References - ArcGIS Snippet Editor is the third in a series of dialog boxes that lets you create or edit an ArcGIS snippet. Use this dialog box to select .NET references (that is, assemblies) that are used by the code in your ArcGIS snippet. See the following screen shot:
 

Using the references option

Select one or more of the References check boxes to specify a reference (assembly). To remove a reference, clear the applicable Reference check box.

Benefits of specifying references

One benefit of the ArcGIS Snippet Finder is the ability to automatically add the necessary references into your Visual Studio project for the block of code being used.
It can be frustrating when you have a chuck of shortened syntax code (that is, not fully qualified) and you try to determine which assemblies need to be added to the Visual Studio project to get the code to compile. By specifying the appropriate references for your ArcGIS snippet, you will not have to worry about this situation when using the ArcGIS Snippet Finder.
  • The ArcGIS Snippet Finder automatically inserts the appropriate using (C#) or Imports (Visual Basic) statements at the top of the class file and if necessary, shortens the code syntax.
For more information about these benefits, see "Insertion preferences" in the topic, Code insertion options. The information that is added for references is also used to generate the Additional Comments section, "Add the following references to the project."

Using the ArcGIS Snippet Editor Manager

The choices on the ArcGIS Snippet Editor Manager can be customized. To add or remove ArcGIS references, open the ArcGIS Snippet Editor Manager dialog box and choose Options from the Tools menu. See the following screen shot:
When you choose Options from the Tools menu, the following Options - ArcGIS Snippet Editor Manager screen shot shows:
The following outlines the use of references on the Options - ArcGIS Snippet Editor Manager dialog box:
  • Add references—To add a reference that is not in the default list, type the reference's fully qualified name (without the .dll extension) in the Add Custom References text box and click Add. Do not include the path location as part of the reference name.
  • Remove references—To remove a reference, select the reference and click Remove.
  • Reset references—To reset references to its initial installation state of the ArcGIS Snippet Editor, click Reset Default References.
For more information on the ArcGIS Snippet Editor Manager, see Customization options for the ArcGIS Snippet Editor Manager.

Special considerations for references

The ArcGIS Snippet Finder retrieves the fully qualified name (for example, ESRI.ArcGIS.Carto) of the reference necessary for the code from the Extensible Markup Language (XML) for the ArcGIS snippet file.
The directory location for .NET assemblies is not stored in an ArcGIS snippet file (some computers might have assemblies in different locations). The ArcGIS Snippet Finder has an XML preferences configuration file that stores where on disk to search for assemblies. The following is the location of the ArcGIS Snippet Finder preferences file:
  • %APPDATA%\ESRI\ArcGISSnippets\Settings\ArcGISSnippetPreferences9.xml
The %APPDATA% environment variable is set by the Windows operating system. To verify the %APPDATA% location, type %APPDATA% in Windows Explorer's Address bar, then press Enter. 
The <ReferenceDirectory> XML tag is located in ArcGISSnippetPreferences9.xml. The following code example shows the default XML in the ArcGISSnippetPreferences9.xml file to search for .NET assemblies:
[XML]
<ReferenceDirectories>
  <ReferenceDirectory>C:\Program Files\Microsoft.NET\Primary Interop Assemblies\</ReferenceDirectory>
  <ReferenceDirectory>C:\Program Files\Microsoft Shared\MSEnv\PublicAssemblies\</ReferenceDirectory>
</ReferenceDirectories>
You can specify that the ArcGIS Snippet Finder searches a custom directory location for your .NET assemblies. For example, if you changed your assembly's location to C:\MyAssembly\MyAssembly.dll, you can modify the ArcGISSnippetPreferences9.xml file to include your custom assembly in the ArcGIS Snippet Finder. See the following code example of a modified ArcGISSnippetPreferences9.xml file:
[XML]
<ReferenceDirectories>
  <ReferenceDirectory>C:\Program Files\Microsoft.NET\Primary Interop Assemblies\</ReferenceDirectory>
  <ReferenceDirectory>C:\Program Files\Microsoft Shared\MSEnv\PublicAssemblies\</ReferenceDirectory>
  <ReferenceDirectory>C:\MyAssembly\</ReferenceDirectory>
</ReferenceDirectories>


See Also:

ArcGIS Snippet Editor
Overview of the ArcGIS Snippet Editor Manager
Customization options for the ArcGIS Snippet Editor Manager
Title, long description, type, and directory options for the ArcGIS Snippet Editor
Source code option for the ArcGIS Snippet Editor
Extensions, products, and versions options for the ArcGIS Snippet Editor
Statements option for the ArcGIS Snippet Editor
Snippets for ArcGIS .NET developers
ArcGIS Snippet Finder




Additional Requirements
  • Use display settings of 96 dots per inch (dpi) when using the ArcGIS Snippet Finder and ArcGIS Snippet Editor.

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