AnsweredAssumed Answered

"GeoProcessorClass()" produce compile error

Question asked by geonetadmin on Apr 1, 2011
Original User: Julie6

I'm implementing a COM extension in VS 2010 target .NET 4. I followed the walkthrough "Consuming a geoprocessing model tool in .NET" and tried to run a script tool I created. The tool runs fine in ArcMap. But when I trying to run it in my .NET the first line give me a compile error:

               
IGeoProcessor2 gp = new GeoProcessorClass();   //compile error, can only do: GeoProcessor gp = new GeoProcessor();

                gp.AddToolbox(@"C:\Projects\ModelBuilder\MyToolbox.tbx");
                IVariantArray parameters = new VarArray();
                parameters.Add(@"C:\Projects\ModelBuilder");
                parameters.Add(@"C:\Projects\ModelBuilder\output");
                parameters.Add("JPEG");
                try
                {
                    gp.Execute("Print Exprt MXD", parameters, null);
                    
                }
                catch (Exception ex) { }


Why can't I use "IGeoProcessor2 gp = new GeoProcessorClass()"?

Thanks.

Attachments

Outcomes