0% found this document useful (0 votes)
5 views2 pages

Compiling .NET Samples for ArcGIS

This document discusses how to use .NET samples for ArcGIS. It explains that the samples must be compiled before use, which can be done in Visual Studio.NET. It also describes how to register .NET components with COM so they can be used in ArcGIS applications like ArcMap, including setting properties and using registration tools.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Compiling .NET Samples for ArcGIS

This document discusses how to use .NET samples for ArcGIS. It explains that the samples must be compiled before use, which can be done in Visual Studio.NET. It also describes how to register .NET components with COM so they can be used in ArcGIS applications like ArcMap, including setting properties and using registration tools.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

How to use the samples [Link]

htm

ArcGIS SDK
Samples
How to use the .NET samples
This topic discusses compiling .NET solutions and registering .NET components with COM. For more information on adding and
removing ArcGIS application customizations, please see How to use the COM samples.
Compiling .NET Solutions
Plugging .NET Components into ArcGIS Applications

Compiling .NET Solutions


All of the .NET samples require compilation before they can be used. It is easiest to compile the solutions using Visual
[Link] 2003.
Open the solution file (.sln) using Visual [Link] 2003
Check the solution configuration, decide if you want to build the solution in debug or release mode.
From the 'Build' menu, select 'Rebuild Solution'.
Compiling the solution will generate a dll or exe depending on the the project type.
If the sample produces a dll it will likely additinally generate and register a tlb so the components can work with COM
interop.

Plugging .NET Components into ArcGIS Applications


.NET samples that extend an ArcGIS application such as a custom ArcCatalog command and ArcMap Edit Task need to
register themselves with COM and in the appropriate component category.

Registering .NET Components for COM


All of the .NET samples that use COM interop will already have the 'Register for COM Interop' property sent to True which tells
the compiler to additionally generate a TLB and register it with COM. To check a project's settings, select 'Project Properties'
from the 'Project' menu and then look at the Build property under 'Configuration Properties'. The very last item is 'Register for
COM Interop' and this property should be set to True if the component is a dll that extends an ArcGIS application such as a
custom command or edit task in ArcMap. If this setting is incorrect, please reset it accordingly and recompile the sample.

1 of 2 5/27/2011 11:50 PM
How to use the samples [Link]

You can register a .NET solution with COM manually using [Link] which is part of the .NET SDK. The following command
line shows an example.
regasm [Link] /tlb:[Link] /codebase

Registering Components in Componet Categories


Most of the .NET samples that must be registered in a specific component category have code that automatically performs this
operation whenever the assembly is registered with COM. These samples make use of the [Link] namespace which
has classes with static functions to register and unregister components in each component category. The sample code excerpt
below gives an example of this.

[Guid("74b3d982-e4ae-4817-8315-6f025cc270df")]
public sealed class AngleAngleTool: BaseTool
{
[ComRegisterFunction()]
static void Reg(String regKey)
{
[Link](regKey);
}

[ComUnregisterFunction()]
static void Unreg(String regKey)
{
[Link](regKey);
}
If the sample you are working with does not have these functions you must manually register the sample in the appropriate
component category use [Link].
Fore more information on using Categories and adding and removing items from the ArcGIS applicstions, see How to use the
COM samples and the documentation on using [Link].

Send feedback on this page

2 of 2 5/27/2011 11:50 PM

You might also like