Reputation: 1642
Attempting to use Microsoft.TeamFoundationServer.ExtendedClient 15.112.1
https://www.nuget.org/packages/Microsoft.TeamFoundationServer.ExtendedClient/
Using Visual Studio 2017
This code in a console app works just fine:
string tfsUrl = "{{tfsurl}}";
string project = "{{project}}";
TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(TfsTeamProjectCollection.GetFullyQualifiedUriForName(tfsUrl));
ITestManagementService tms = tfs.GetService<ITestManagementService>();
var proj = tms.GetTeamProject(project);
This code in a TestMethod as part of a Unit Test project does not:
string tfsUrl = "{{tfsurl}}";
string project = "{{project}}";
TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(TfsTeamProjectCollection.GetFullyQualifiedUriForName(tfsUrl));
ITestManagementService tms = tfs.GetService<ITestManagementService>();
var proj = tms.GetTeamProject(project);
Assert.IsNotNull(proj);
It throws an exception on the tms.GetTeamProject(project)
:
System.DllNotFoundException: 'Unable to load DLL 'Microsoft.WITDataStore32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)'
Solutions I have tried:
Copying the WITDataStore32.dll to the bin directory
Copying WITDataStore32.dll from the packages\Microsoft.TeamFoundationServer.ExtendedClient.15.112.1\lib\native\x86
folder and into the C:\Windows\System32
Copying WITDataStore32.dll from the packages\Microsoft.TeamFoundationServer.ExtendedClient.15.112.1\lib\native\x86
folder and into the C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE
folder
Installing the Team Foundation Server TFS Package and copying the WITDataStore32.dll from the C:\Program Files (x86)\Microsoft Visual Studio\2017\TeamExplorer\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
folder and into the C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE
folder
Nothing has worked so far...
Full stack dump below:
Result StackTrace:
at Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.DataStoreNative32.CreateDatastore(IntPtr& handle)
at Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.DataStoreNative.CreateDatastore(IntPtr& handle)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.InitializeInternal()
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore.Microsoft.TeamFoundation.Client.ITfsTeamProjectCollectionObject.Initialize(TfsTeamProjectCollection teamProjectCollection)
at Microsoft.TeamFoundation.Client.TfsTeamProjectCollection.InitializeTeamFoundationObject(String fullName, Object instance)
at Microsoft.TeamFoundation.Client.TfsConnection.CreateServiceInstance(Assembly assembly, String fullName)
at Microsoft.TeamFoundation.Client.TfsConnection.GetServiceInstance(Type serviceType, Object serviceInstance)
at Microsoft.TeamFoundation.Client.TfsTeamProjectCollection.GetServiceInstance(Type serviceType, Object serviceInstance)
at Microsoft.TeamFoundation.Client.TfsConnection.GetService(Type serviceType)
at Microsoft.TeamFoundation.TestManagement.Client.TestManagementTeamProject.GetWitProject()
at Microsoft.TeamFoundation.TestManagement.Client.TestManagementTeamProject.get_WitHelper()
at Microsoft.TeamFoundation.TestManagement.Client.TestManagementTeamProject.get_SharedParameterDataSetWorkItemTypeName()
at Microsoft.TeamFoundation.TestManagement.Client.TestManagementTeamProject.get_HasSupportForSharedParameterDataSets()
at Microsoft.TeamFoundation.TestManagement.Client.TestManagementTeamProject..ctor(TestManagementService manager, String projectName)
at Microsoft.TeamFoundation.TestManagement.Client.TestManagementService.<GetTeamProject>b__0_0(String name)
at Microsoft.TeamFoundation.TestManagement.Client.ObjectCache`2.Get(Key key, Creator creator)
at Microsoft.TeamFoundation.TestManagement.Client.TestManagementService.GetTeamProject(String projectName)
at CodedUITestProject1.CodedUITest1.CodedUITestMethod1() in c:\users\me\source\repos\CodedUITestProject1\CodedUITestProject1\CodedUITest1.cs:line 32
Result Message:
Test method CodedUITestProject1.CodedUITest1.CodedUITestMethod1 threw exception:
System.DllNotFoundException: Unable to load DLL 'Microsoft.WITDataStore32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Upvotes: 0
Views: 720
Reputation: 29
You also need to install Microsoft.TeamFoundationServer.Client
Then when creating an installer, then you need to take the file above from the output directory, add it as a resource (copy always) to your file. The Publish activity will otherwise not recognize it, and thus the execution will fail.
Upvotes: 0