[GIS] ArcGIS Engine License Switch

arcgis-10.0arcgis-enginearcgis-license-manager

Is it possible to change to a "higher-level" license after a license has already been checked out in ArcGIS Engine? Old posts in ESRI forums seem to indicate that this is not possible, but I'm wondering if 9.3 or 10 allows this.

We have an application that 99%+ is used for viewing GIS data, so the ArcGIS Engine Runtime license is appropriate. Every now and then, though some (not all) users need to be able to edit an arc or two and it would be extremely annoying and disruptive to their workflow to have to exit the application and fire it up again just to grab an ArcInfo license.

Best Answer

I don't see anything in the documentation that says you cannot switch. However the code below isn't able to switch. Maybe report this as a bug and see what happens.

Update: As Michael points out, the documentation says this is not supported.

private void SwitchLicense1()
{
    if (ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Product == ESRI.ArcGIS.ProductCode.Engine)
    {
        ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);
        if (ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Product == ESRI.ArcGIS.ProductCode.Engine)
            Debug.Print("unable to switch to desktop");
        else
            Debug.Print("switched to desktop license");
    }
    else
    {
        ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Engine);
        if (ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Product == ESRI.ArcGIS.ProductCode.Desktop)
            Debug.Print("unable to switch to engine");
        else
            Debug.Print("switched to desktop license");
    }
}
private void SwitchLicense2()
{
    IAoInitialize aoInit = new AoInitializeClass();
    Debug.Print("before license: {0}", aoInit.InitializedProduct());
    if (aoInit.InitializedProduct() == esriLicenseProductCode.esriLicenseProductCodeEngine)
    {
        aoInit.Shutdown();
        aoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcEditor);
    }
    else
    {
        aoInit.Shutdown();
        aoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngine);
    }
    Debug.Print("after license: {0}", aoInit.InitializedProduct());
}
Related Question