2017-04-12 93 views
0

我想創建一個庫來調用web服務,它很簡單,我有: 1.library class proyect framework 4.6.1 2.從金塊我添加Newtonsoft.Json v10.0.2 3.FRom塊添加System.Net.Http v4.3.1 4. FRom塊我添加System.Net.Http.Formating .Extention v5.2.3參考問題system.net.http nuget包4.3.1 coul不加載system.net.http 4.1.1

我得到這個功能:

 static async public Task<ObservableCollection<CProyecto>> GetProyectos() 
     { 
     try 
     { 
      using (System.Net.Http.HttpClient client = new System.Net.Http.HttpClient()) 
      { 
     ........... 
      } 
     } 
     catch (Exception e) 
     { 
      Error = e.Message; 
     } 
     return something; 
    } 

當我跑我得到一個運行時錯誤:

"Could not load file or assembly 'System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified..":"System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 

我真的不知道該怎麼辦......我已經使用舊版本的BU我得到了同樣的錯誤

任何想法試試? 由於事先

回答

0

一天我發現這個問題後,...也許將是有益的人: 我有一個視圖模型項目引用我的「問題」項目(項目ServiceCaller) 錯誤位於在ViewModel項目上。它有一個對System.Net.Http 4.0.0的引用。我只是刪除了對該程序集的引用,現在所有工作都在進行中。

相關問題