Open Shape File in Silverlight Applicatin error?

Discussion created by johnchill on Feb 14, 2011
I am trying to open a shape file in a Visual Studio 2010 Silverlight application.  I have inserted the Example code found in the ArcGis Engine documentation ( See Code Below).

The statement:                 Dim workspaceFactory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory   = New ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass

Causes the compiler to generate: Interop type 'ShapefileWorkspaceFactoryClass' cannot be embedded. Use the applicable interface instead.

I don't understand this error, any help will be very appreciated.


    Public Function GetFeatureClassFromShapefileOnDisk(ByVal string_ShapefileDirectory As System.String, ByVal string_ShapefileName As System.String) As ESRI.ArcGIS.Geodatabase.IFeatureClass

        Dim directoryInfo_check As System.IO.DirectoryInfo = New System.IO.DirectoryInfo(string_ShapefileDirectory)
        If directoryInfo_check.Exists Then

            'We have a valid directory, proceed

            Dim fileInfo_check As System.IO.FileInfo = New System.IO.FileInfo(string_ShapefileDirectory + "\" + string_ShapefileName + ".shp")
            If fileInfo_check.Exists Then

                'We have a valid shapefile, proceed

                Dim workspaceFactory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory = New ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass
                Dim workspace As ESRI.ArcGIS.Geodatabase.IWorkspace = workspaceFactory.OpenFromFile(string_ShapefileDirectory, 0)
                Dim featureWorkspace As ESRI.ArcGIS.Geodatabase.IFeatureWorkspace = CType(workspace, ESRI.ArcGIS.Geodatabase.IFeatureWorkspace) ' Explict Cast
                Dim featureClass As ESRI.ArcGIS.Geodatabase.IFeatureClass = featureWorkspace.OpenFeatureClass(string_ShapefileName)

                Return featureClass

                'Not valid shapefile
                Return Nothing
            End If


            ' Not valid directory
            Return Nothing

        End If

    End Function