Azure Sphere–「Object reference not set to an instance of an object」 解決辦法

  • 2019 年 10 月 8 日
  • 筆記

在開發Azure Sphere應用時,如果出現項目無法編譯,出現「Object reference not set to an instance of an object」時,必須從下面兩個方面進行檢查。

1. 檢查Visual Studio 2017安裝時,是否安裝了Desktop Development with C++組件,另外,是否選中了"Visual C++ tools for CMake and Linux" 和 "Embedded and IoT Development"這兩個項目,如下圖所示。

2. 安裝完成以後,去https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ClearMEFComponentCache這裡下載Visual Studio的MEF組件清理插件並安裝。安裝完成以後,在Visual Studio 2017的Tools-Clear MEF Component cache菜單中清除Cache。

3.之後,用Visual Studio打開Azure Sphere的工程,點擊Build-Rebuild Solution,就可以重新編譯項目了。