2016-09-01 2 views
0

Ich kann keine Verbindung zu Team Foundation Server 2010 (TFS) über eine einfache C# -Konsolenanwendung herstellen. Meine Konsolenanwendung hat .Net Framework 4.5 als Zielframework und ist in VS2015 geöffnet. In dem Projekt habe ich die TFS-API mit Nuget referenziert, im Bild unten können Sie die Baugruppen sehen. Project_Configuration Und das ist der einfache CodeDie Verbindung zu TFS 2010 ist programmgesteuert nicht möglich. VS2015

using Microsoft.TeamFoundation.Client; 
using System; 
using System.Configuration; 
using System.Data; 
using System.IO; 

namespace FindWorkItemChangesetDetails 
{ 
    public class Program 
    { 
     static void Main(string[] args) 
     { 
      string TfsServer = "http://xx.xxx.xxx.xx:8080/tfs"; 

      ////Initialize TFS Server object 
      TfsConfigurationServer configurationServer = 
       TfsConfigurationServerFactory.GetConfigurationServer(new Uri(TfsServer)); 
     } 
} 

Die Ausnahme zurückgekehrt ist:

System.IO.FileNotFoundException was unhandled 
    FileName=Microsoft.VisualStudio.Services.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
    FusionLog==== Informazioni sullo stato di preassociazione === 
REG: DisplayName = Microsoft.VisualStudio.Services.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
(Fully-specified) 
REG: Appbase = file:///C:/Sviluppo/Tool/FindWorkItemChangesetDetails/bin/Debug/ 
REG: PrivatePath iniziale = NULL 
Assembly chiamante: Microsoft.TeamFoundation.Client, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. 
=== 
REG: l'associazione ha origine nel contesto di caricamento di default. 
REG: utilizzo del file di configurazione dell'applicazione: C:\Sviluppo\Tool\FindWorkItemChangesetDetails\bin\Debug\FindWorItemChangesetDetails.vshost.exe.config 
REG: utilizzo del file di configurazione host: 
REG: utilizzo del file di configurazione computer da C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
REG: riferimento post-criteri: Microsoft.VisualStudio.Services.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 
REG: tentativo di download del nuovo URL file:///C:/Sviluppo/Tool/FindWorkItemChangesetDetails/bin/Debug/Microsoft.VisualStudio.Services.Common.DLL. 
REG: tentativo di download del nuovo URL file:///C:/Sviluppo/Tool/FindWorkItemChangesetDetails/bin/Debug/Microsoft.VisualStudio.Services.Common/Microsoft.VisualStudio.Services.Common.DLL. 
REG: tentativo di download del nuovo URL file:///C:/Sviluppo/Tool/FindWorkItemChangesetDetails/bin/Debug/Microsoft.VisualStudio.Services.Common.EXE. 
REG: tentativo di download del nuovo URL file:///C:/Sviluppo/Tool/FindWorkItemChangesetDetails/bin/Debug/Microsoft.VisualStudio.Services.Common/Microsoft.VisualStudio.Services.Common.EXE. 

    HResult=-2147024894 
    Message=Impossibile caricare il file o l'assembly 'Microsoft.VisualStudio.Services.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' o una delle relative dipendenze. Impossibile trovare il file specificato. 
    Source=Microsoft.TeamFoundation.Client 
    StackTrace: 
     in Microsoft.TeamFoundation.Client.TfsClientCredentials.LoadCachedCredentials(String featureRegistryKeyword, Uri serverUrl, Boolean requireExactMatch, Boolean allowInteractive, String registryRootPath, Boolean useWOW6432Hive) 
     in Microsoft.TeamFoundation.Client.TfsClientCredentialsCache.GetCredentials(String featureRegistryKeyword, Uri uri) 
     in Microsoft.TeamFoundation.Client.TfsConfigurationServerFactory.GetConfigurationServer(Uri uri) 
     in FindWorkItemChangesetDetails.Program.Main(String[] args) in C:\Sviluppo\Tool\FindWorkItemChangesetDetails\Program.cs:riga 16 
     in System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
     in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
     in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
     in System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
     in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     in System.Threading.ThreadHelper.ThreadStart() 
    InnerException: 

Nachdem ich die Microsoft.Visual Studio.Services.Common verwiesen habe ich diesen Fehler

System.TypeLoadException was unhandled 
    HResult=-2146233054 
    Message=Impossibile caricare il tipo 'Microsoft.TeamFoundation.Common.Internal.RegistryAccessMask' dall'assembly 'Microsoft.TeamFoundation.Common, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. 
    Source=Microsoft.TeamFoundation.Client 
    TypeName=Microsoft.TeamFoundation.Common.Internal.RegistryAccessMask 
    StackTrace: 
     in Microsoft.TeamFoundation.Client.CredentialsCacheManager..ctor() 
     in Microsoft.TeamFoundation.Client.TfsClientCredentials.LoadCachedCredentials(String featureRegistryKeyword, Uri serverUrl, Boolean requireExactMatch, Boolean allowInteractive, String registryRootPath, Boolean useWOW6432Hive) 
     in Microsoft.TeamFoundation.Client.TfsClientCredentialsCache.GetCredentials(String featureRegistryKeyword, Uri uri) 
     in Microsoft.TeamFoundation.Client.TfsConfigurationServerFactory.GetConfigurationServer(Uri uri) 
     in FindWorkItemChangesetDetails.Program.Main(String[] args) in C:\Sviluppo\Tool\FindWorkItemChangesetDetails\Program.cs:riga 16 
     in System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
     in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
     in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
     in System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
     in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     in System.Threading.ThreadHelper.ThreadStart() 
    InnerException: 

Irgendeine Idee, um das Problem zu beheben? Danke Luca

+0

Der Fehler besagt, dass Sie einen Verweis auf 'Microsoft.VisualStudio.Services.Common, Version = 12.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a' hinzufügen müssen – stuartd

Antwort

0

In VS2015, können Sie den DLLs in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer finden können, versuchen Sie den DLLs aus dem Pfad hinzuzufügen.

Verwandte Themen