Type t = Type.GetTypeFromProgID("esriDataSourcesGDB.AccessWorkspaceFactory.1");//("{DD48C96A-D92A-11D1-AA81-00C04FA33A15}"); System.Object obj = Activator.CreateInstance(t);
I am developing ArcMap extensions quite frequently, but it was never a problem to create an instance in C# with the new keyword. May be you are developing an ArcGIS engine application? In this case, I would try to check out a license before instantiating the geoprocessor object.
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000043p000000
The Geoprocessor is not listed, so using the Activator class is not the right way.
Best regards, Stefan
ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass fcToFcTool = new ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass(); fcToFcTool.in_features = featureLayer; fcToFcTool.out_path = outputDirectory; fcToFcTool.out_name = newTableName; if (!string.IsNullOrEmpty(query)) fcToFcTool.where_clause = query; Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor(); gp.Execute(fcToFcTool, null);
Below is the code from a Windows service that I wrote a while back. I fully qualified the class names to avoid confusion with the old Geoprocessor class in the Geoprocessing library.ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass fcToFcTool = new ESRI.ArcGIS.ConversionTools.FeatureClassToFeatureClass(); fcToFcTool.in_features = featureLayer; fcToFcTool.out_path = outputDirectory; fcToFcTool.out_name = newTableName; if (!string.IsNullOrEmpty(query)) fcToFcTool.where_clause = query; Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor(); gp.Execute(fcToFcTool, null);
Creating an instance of the COM component with CLSID {5374EC4C-1AA2-4829-A811-DE624ECEC23F} from the IClassFactory failed due to the following error: 80010105
Sounds like this might be an install issue ... if you search your registry, do you find this key?
If not, consider re-installing.
public static void TestGp() { Guid g = new Guid("5374EC4C-1AA2-4829-A811-DE624ECEC23F"); Type t = Type.GetTypeFromCLSID(g); Debug.Print(t.ToString()); GeoProcessor gp = Activator.CreateInstance(t) as GeoProcessor; Debug.Print(gp.OverwriteOutput.ToString()); }
Here's the key I have (on Vista64):
HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{5374EC4C-1AA2-4829-A811-DE624ECEC23F}
Do you have this key (or its 32 bit equivalent) ?
Does this code work for you?public static void TestGp() { Guid g = new Guid("5374EC4C-1AA2-4829-A811-DE624ECEC23F"); Type t = Type.GetTypeFromCLSID(g); Debug.Print(t.ToString()); GeoProcessor gp = Activator.CreateInstance(t) as GeoProcessor; Debug.Print(gp.OverwriteOutput.ToString()); }