2016-04-18 11 views
0

TFSに接続して作業項目のステータスを確認しようとしています。しかし、私はコードを実行するたびに、私は次のエラーメッセージが表示されます:C#TFSへの接続と作業項目の状態の確認

型「System.DllNotFoundException」の未処理の例外はMicrosoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader.dll

を発生しました追加情報:DLL 'Microsoft.WITDataStore32.dll'を読み込めません:指定されたモジュールが見つかりませんでした。 (HRESULTからの例外:0x8007007E)コードが当たったとき

が発生します。WorkItemStore workItemStore =(WorkItemStore)tfs.GetService(typeof演算(WorkItemStore))。

私は、次のDLLの参照があります。 - Microsoft.TeamFoundation.Client - Microsoft.TeamFoundation.WorkItemTracking.Client を - ここMicrosoft.TeamFoundation.WorkItemTracking.Client.DataStoreLoader

は私のコードです。

private static void connectToTfs(int executionType) 
    { 
     Console.WriteLine("Starting to work on TFS"); 

     // Supply the credentials of the user who will be impersonated to create the bug 
     ICredentials credentials = CredentialCache.DefaultNetworkCredentials; 

     TfsTeamProjectCollection tfs = 
      new TfsTeamProjectCollection(new Uri("http://URL:8080/Team"), credentials); 

     if (tfs.HasAuthenticated == true) 
     { 
      Console.WriteLine("Connected to TFS"); 
      WorkItemStore workItemStore = (WorkItemStore)tfs.GetService(typeof(WorkItemStore)); 

      switch (executionType) 
      { 
       case 1: 
        //create query 
        string queryString = "Select [State] From WorkItems Where [ID] = '4123567' "; 

        //Dictionary for storing variables 
        Dictionary<string, string> variables = new Dictionary<string, string>(); 
        variables.Add("ID", "State"); 

        Query query = new Query(workItemStore, queryString, variables); 
        WorkItemCollection results = query.RunQuery(); 

        foreach (KeyValuePair<string, string> kvp in variables) 
        { 
         Console.WriteLine("ID {0} state is {1}", kvp.Key, kvp.Value); 
        } 

        break; 
      } 
     } 
    } 

答えて

0

Thisは、回避策がある可能性があります。

それは手動Microsoft.WITDataStore32に名前を変更Microsoft.WITDataStoreのGAC32バージョンを見つけて、あなたのプロジェクト

のbinフォルダに追加することを提案
関連する問題