2013年7月12日 星期五

VS2010 WCF 無法載入 System.ServiceModel.Web 之解決方法 (Visual Studio 2010 - WCF Using System.ServiceModel.Web Problem)

當使用 Visual Studio 2010 建立 C# "WCF 服務程式庫" 專案時,若於程式中引用 System.ServiceModel.Web (Using System.ServiceModel.Web) 且建置時發生錯誤訊息:
"命名空間 'System.ServiceModel' 中沒有型別或命名空間名稱 'Web' (您是否遺漏了組件參考?)"。請針對以下兩部分進行檢查 --


一、專案屬性 設定

1) 上方工具列中,點選 專案 --> 屬性



2) 於屬性畫面中,將 應用程式 --> 目標 Framework 設定為 ".NET Framework 4"



3) 此時將出現確認視窗,點選 "是"。




二、參考 設定

1) 於 "方案總管" 中,Highlight 參考後,再按下滑鼠右鍵,選取 "加入參考"。


2) 於出現的 "加入參考" 視窗中,點選 ".NET" 頁籤 --> "System.ServiceModel.Web" 後,按下 "確定" 即可。