You are here: > ESRI Forums > arcgis server forums > Thread Replies

ArcGIS Server Forums

ArcGIS Server .Net: Developing applications forum

Utility COM object: How to???   Michael Rutkowski Jul 24, 2007
Re: Utility COM object: How to???   Vish Uma Jul 24, 2007
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Utility COM object: How to??? 
Author Michael Rutkowski 
Date Jul 24, 2007 
Message I'm having a bit of trouble Creating, registering, and deploying a utility COM object that I created.
My biggest issue is when I do add the following tags to my code (either/or/both)
- GuidAttribute("1FFA6B75-D634-48AE-9BB1-D4DC783C1F27") _

- AutomationProxy(True), ClassInterface(ClassInterfaceType.AutoDual), Guid("1FFA6B75-D634-48AE-9BB1-D4DC783C1F27") _

A couple things to add/question. I'm creating these utility COM objects by creating a new class library project. Seems logical enough (but perhaps I should be using a windows COM control???).

I'm obtaining my guid that is automatically obtained from the assembly info to place in the assembly information tags.

My Comvisible attribute IS set to true

My Register For COM interop setting IS checked (in the compile tab of the project properties)
(when this is NOT checked no tlb file is created)

my project won't compile (when the COM interop setting is checked). I get the following output.

cls_MRLASelectRoute2.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(2721,9): error MSB3212: The assembly "C:\Tools\Applications\cls_MRLASelectRoute2\cls_MRLASelectRoute2\cls_MRLASelectRoute2\bin\Release\cls_MRLASelectRoute2.dll" could not be converted to a type library. Type library exporter encountered an error while processing 'cls_MRLASelectRoute2.Icls_MRLARouteSelection, cls_MRLASelectRoute2'. Error: Element not found.
Done building project "cls_MRLASelectRoute2.vbproj" -- FAILED.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========


Thank you,
Mike 
 
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Runtime.InteropServices
Imports System.EnterpriseServices
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.Display
Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.Geodatabase
Imports ESRI.ArcGIS.Geometry
<GuidAttribute("1FFA6B75-D634-48AE-9BB1-D4DC783C1F27")> _
Public Interface Icls_MRLARouteSelection
    Function SelectRoute(ByVal pRouteFeatureClass As ESRI.ArcGIS.Geodatabase.IFeatureClass, ByVal sRouteName As String) As ESRI.ArcGIS.Geometry.IPolyline
End Interface
Namespace cls_MRLASelectRoute2
    '<AutomationProxy(True), ClassInterface(ClassInterfaceType.AutoDual)> _
    <AutomationProxy(True), ClassInterface(ClassInterfaceType.AutoDual), Guid("1FFA6B75-D634-48AE-9BB1-D4DC783C1F27")> _
    Public Class cls_MRLARouteSelection
        '        '        <AutomationProxy(True), ClassInterface(ClassInterfaceType.AutoDual), GuidAttribute("1FFA6B75-D634-48AE-9BB1-D4DC783C1F27")> _
        Inherits ServicedComponent
        Implements Icls_MRLARouteSelection

        Public Sub New()
            MyBase.New()
        End Sub

        Public Function SelectRoute(ByVal pRouteFeatureClass As ESRI.ArcGIS.Geodatabase.IFeatureClass, ByVal sRouteName As String) As ESRI.ArcGIS.Geometry.IPolyline Implements Icls_MRLARouteSelection.SelectRoute
            Try
                Dim pPline As IPolyline = Nothing
                Dim pCursor As ESRI.ArcGIS.Geodatabase.IFeatureCursor
                Dim pFeat As IFeature

                Dim pQF As ESRI.ArcGIS.Geodatabase.IQueryFilter2
                pQF = New ESRI.ArcGIS.Geodatabase.QueryFilter

                If Not pRouteFeatureClass Is Nothing Then
                    If sRouteName <> "" Then

                        pQF.WhereClause = "ROUTEKEY = '" & sRouteName & "'"
                        pCursor = pRouteFeatureClass.Search(pQF, False)
                        pFeat = pCursor.NextFeature
                        If Not pFeat Is Nothing Then
                            If pFeat.ShapeCopy.GeometryType = esriGeometryType.esriGeometryPolyline Then
                                pPline = pFeat.ShapeCopy
                            End If
                        End If
                    End If
                End If
                pQF = Nothing
                pFeat = Nothing
                pCursor = Nothing
                Return pPline
            Catch ex As Exception
                Return Nothing
            End Try
        End Function
    End Class

End Namespace
 
  Michael Rutkowski
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: Utility COM object: How to??? 
Author Vish Uma 
Date Jul 24, 2007 
Message Hi Michael,

This is what i use on my class and it works fine.

[Guid("52bbe846-945c-44b5-9252-cff8db9a72f9")]
[AutomationProxy(true), ClassInterface(ClassInterfaceType.AutoDual)]
[ProgId("XXXXXXXXX.XXX.XXXXXXXXXXXX")]

Also, make sure that the GUID you are providing is unique and not the same as the one for the assembly.

Thank You,
Vish