How to change license type at runtime?

Discussion created by fandre12345 on Nov 28, 2013
I have this code:

        //See i EVER try to check ADVANCED License!!!
        if (ArcLicense.CheckOutExtensionLicense(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeAdvanced))
                doc = new ESRI.ArcGIS.ArcMapUI.MxDocumentClass();

My method CheckOutExtensionLicense is:

        public static bool CheckOutExtensionLicense(esriLicenseProductCode licenseProductCode)
            IAoInitialize aoInitialize = new AoInitializeClass();
            esriLicenseStatus licenseStatus = aoInitialize.IsProductCodeAvailable(licenseProductCode);

            if (licenseStatus == esriLicenseStatus.esriLicenseAvailable)
                licenseStatus = aoInitialize.Initialize(licenseProductCode);
                return true;
            return false;

But when the ArcMap open, it opens with Basic License... I check de Arcgis Administrator and saw this configuration:

I think this configuration overrides my code, and I dont know why... Then my question, have a way to around this?