Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a Student Edition of ArcGIS 10.1 for Desktop Advanced. My license is set up on my machine as single use. I am trying to initialize the license in ArcObjects, however I get the following error:

"ArcGIS product not specified. You must first bind to an ArcGIS version prior to using any ArcGIS components."

This occurs when I call AoInitialize.IsProductCodeAvailable() which doesn't make sense, since that is how you figure out what license to initialize in the first place. Here is my code:

public static esriLicenseStatus Intialize(
        ESRI.ArcGIS.esriSystem.esriLicenseProductCode esriLicenseProductCode)
    {
        IAoInitialize aoInitialize = new AoInitialize();
        esriLicenseStatus esriLicenseStatus = 
            aoInitialize.IsProductCodeAvailable(esriLicenseProductCode);

        if (esriLicenseStatus == ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAvailable)
            esriLicenseStatus = 
                aoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeAdvanced);

        return esriLicenseStatus;
    }

What am I doing wrong? Does this have to do with it being Student Edition?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Try this code using the RuntimeManager class, makes it much simpler:

    if (ESRI.ArcGIS.RuntimeManager.ActiveRuntime == null)
        ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.EngineOrDesktop);

You'll need to add a reference to the ESRI.ArcGIS.Version assembly.

share|improve this answer
    
That did the trick. Thank you. –  dustmouse Feb 17 '13 at 1:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.