Good morning,
I was just diving into accessing Identities (users, groups/-memberships and such) using the new .Net client libraries (https://www.visualstudio.com/integrate/get-started/client-libraries/dotnet) and while I do have all three Nuget packages installed in the project, the following call throws an FileNotFoundFoundException for the 'Microsoft.VisualStudio.Services.OrganizationTenant' assembly:
var visualStudioServicesConnection = new VssConnection(new Uri(BaseUri), new VssCredentials()); var identityHttpClient = visualStudioServicesConnection.GetClient<IdentityHttpClient>(); // the following line is where the exception is thrown: var identity = await identityHttpClient.GetIdentitySelfAsync();
The full exception looks like this:
-----------------------------
System.AggregateException was unhandledHResult=-2146233088
Message=One or more errors occurred.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at _05_Teams.Program.Main(String[] args) in D:\Development\GitHub\VSTeamServicesAndTfsRestApi\05-Teams\Program.cs:line 31
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
ErrorCode=0
EventId=3000
HResult=-2146232832
LogException=false
Message=Could not load file or assembly 'Microsoft.VisualStudio.Services.OrganizationTenant, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
ReportException=false
Source=Microsoft.VisualStudio.Services.WebApi
StackTrace:
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponse(HttpResponseMessage response)
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<SendAsync>d__79.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<SendAsync>d__76`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<SendAsync>d__65`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.<SendAsync>d__64`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.Identity.Client.IdentityHttpClient.<GetIdentitySelfAsync>d__17.MoveNext()
InnerException:
HResult=-2147024894
Message=Could not load file or assembly 'Microsoft.VisualStudio.Services.OrganizationTenant, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
InnerException:
-----------------------------
Now the problem is - none of the NuGet packages on the site contain the assembly that's missing, so I am wondering whether this is / was an oversight for the current stable version (I am using v14.95.3) and it's really and incorrectly missing, or is there any other NuGet package I must reference, too?
Thanks,
-J