shrug-l: RE: Create File Geodatabase in vb.net

Janelle Brown Janelle.Brown at citizensfla.com
Wed Aug 10 14:13:41 EDT 2011


This is why I love the SHRUG listserv!!

 

Thank you so much Mark Welsh @ DOT for pointing me in the right direction. The error I stated below was not indicative of the actual problem. To work in VS 10 with ArcObjects, you must reference an ESRI product to be able to actually USE ArcObjects (because VS is stand-alone and not embedded in an ESRI product). There is plenty of code out there on how to do it yourself, but the easiest way is to use the "add ArcGIS License Checking" wizard (thanks again for pointing me to this Mark!). This is easy enough, but the real problem is the error that is thrown after the wizard inserts the appropriate code: 

 

Interop type 'AoInitializeClass' cannot be embedded. Use the applicable interface instead.

 

This seems to be a problem unique to the 4.0 Framework as it no longer allows classes to be embedded. There is a plethora of info on this error and all of the solutions are to change the 'Embed Interop Types' to 'False' within the referenced assembly properties. Easy enough - unless you have no idea where exactly this is located! I've included the instructions for anyone who wants to successfully use ArcObjects in Visual Studio 2010 with the .Net 4.0 Framework (this is after you've installed the SDK). 

 

1.)    Project à Add ArcGIS License Checking" à point towards your product àfinish

2.)    (in Solution Explorer) Right click on project à Properties à References àESRI.ArcGIS.System à set 'Embed Interop Types' to 'false'

 

Boom!  You're ready to go! 

 

Hope this helps anyone else struggling!

 

 

Janelle Brown

GIS Analyst, Corporate Analytics

Citizens Property Insurance Corporation

-------------------------------------------------------

ofc. 850.521.8373   |   cell 850.879.2374

 

Janelle

From: Janelle Brown 
Sent: Tuesday, August 09, 2011 11:46 AM
To: 'shrug-L at lists.dep.state.fl.us'
Subject: Create File Geodatabase in vb.net

 

Hi Everyone,

 

I have an ArcObjects question I was hoping someone could help answer. I'm trying to create a File Geodatabase using VB.Net in Microsoft VS 10, but I continue to receive the same error.  Here is the code I am using:

 

  Public Shared Function CreateFileGdbWorkspace(ByVal dataPath As String) As IWorkspace

 Dim factoryType As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory")

        Dim workspaceFactory As IWorkspaceFactory = CType(Activator.CreateInstance(factoryType), IWorkspaceFactory)

        Dim workspaceName As IWorkspaceName = workspaceFactory.Create(dataPath, "Features.gdb", Nothing, 0)

 

        Dim Name As IName = CType(workspaceName, IName)

        Dim workspace As IWorkspace = CType(Name.Open(), IWorkspace)

        Return workspace

 End Function

 

The error I receive is:

 

Retrieving the COM class factory for component with CLSID {71FE75F0-EA0C-4406-873E-B7D53748AE7E} failed due to the following error: 80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE)).

 

I've done considerable research on this error and it seems to stem from a license initialization issue. I've found code related to the license initialization, but it's not really working. I'm at a bit of a loss right now because I'm obviously not very proficient at .Net. If anyone has any suggestions, please let me know. 

 

Janelle Brown

GIS Analyst, Corporate Analytics

Citizens Property Insurance Corporation

-------------------------------------------------------

ofc. 850.521.8373   |   cell 850.879.2374

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.dep.state.fl.us/pipermail/shrug-l/attachments/20110810/b2ee94fa/attachment.htm


More information about the SHRUG-L mailing list