Quantcast
Channel: Forums - ArcGIS for Desktop - General
Viewing all articles
Browse latest Browse all 2328

Problems with licensing when creating console application in visual studio 2010

$
0
0
I am following this tutorial http://resources.arcgis.com/en/help/...000002nt000000 and cannot get my geoprocessor to work because the license is not getting set. My project build is set to x86, I have referenced ESRI.ArcGIS.Geoprocessing, geoprocessor, system, version and dataManagementTools, I am using visual studio 2010 and arcgis 10.1 with the sdk installed and using .net framework 3.5. All I am trying to do in my code is to create a geoprocessor object but I get an exception. I think that this is because my license is not getting set properly. Incidentally I had created a class project earlier and the licensing is fine but when i try to reuse that code it doesn't work in this console application. Please help. My code is below:

using System;
using System.Collections.Generic;
using System.Text;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geoprocessor;
using ESRI.ArcGIS.Geoprocessing;
using ESRI.ArcGIS.DataManagementTools;

namespace BCData_ConsoleApp
{
class Program
{
private static LicenseInitializer m_AOLicenseInitializer = new BCData_ConsoleApp.LicenseInitializer();

[STAThread()]
static void Main(string[] args)
{
//Add runtime binding prior to any ArcObjects code in the static void Main() method.
ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);

//ESRI License Initializer generated code.
m_AOLicenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeBasic, esriLicenseProductCode.esriLicenseProductCodeStandard, esriLicenseProductCode.esriLicenseProductCodeAdvanced },
new esriLicenseExtensionCode[] { esriLicenseExtensionCode.esriLicenseExtensionCode3DAnalyst });
//ESRI License Initializer generated code.

// Initialize the geoprocessor.
Geoprocessor geoprocessor = new Geoprocessor();



//Do not make any call to ArcObjects after ShutDownApplication()
m_AOLicenseInitializer.ShutdownApplication();
}
}
}
Attached Thumbnails
Click image for larger version

Name:	console.jpg‎
Views:	N/A
Size:	117.3 KB
ID:	20939  

Viewing all articles
Browse latest Browse all 2328

Trending Articles