ArcGIS10:ArcGIS version not specified. (轉載)

ArcGIS10:ArcGIS version not specified. You must call RuntimeManager.Bind before creating any ArcGIS 

今天將ArcGIS系列的軟件從ArcGIS9.3.1升級到ArcGIS10,然後就使用VS創建一個簡單的AE應用程序,然後拖放一個toolbar、LicenseControl以及MapControl控件。

接着編譯應用程序,編譯成功。

然後單擊F5運行程序,這個時候程序報錯,出現下面所示的錯誤:

ArcGIS version not specified. You must call RuntimeManager.Bind before creating any ArcGIS components.

問題解決方案:

在系統的入口添加下面的一行代碼:

ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);

當然上面這樣代碼也可以添加到其他的適合的位置,本人感覺放到程序的入口最合適

這裏還需要添加一個Reference:ESRI.ArcGIS.Version

完整的參考代碼如下所示:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章