{"id":8561,"date":"2015-08-10T16:24:54","date_gmt":"2015-08-10T16:24:54","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/buckh\/2015\/08\/10\/nuget-packages-for-tfs-and-visual-studio-online-net-client-object-model\/"},"modified":"2015-08-10T16:24:54","modified_gmt":"2015-08-10T16:24:54","slug":"nuget-packages-for-tfs-and-visual-studio-online-net-client-object-model","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/buckh\/nuget-packages-for-tfs-and-visual-studio-online-net-client-object-model\/","title":{"rendered":"NuGet packages for TFS and Visual Studio Online .NET client object model"},"content":{"rendered":"<p>For the past couple of releases we\u2019ve released the Team Foundation Server\/Visual Studio Online client object model as a downloadable installer (aka MSI). Additionally, the license for it did not include the right to package it in an application for redistribution. As a result, it was inconvenient for builds and added friction for installing an app that depended on it (at least on machines without Visual Studio or Team Explorer). Additionally, the client libraries were installed into the .NET GAC in previous versions, which meant that you couldn\u2019t have an application have its own copy of the client libraries \u2013 installing a newer client object model would affect Visual Studio and TFS if they were installed on the same machine and using the same major version but perhaps a different update level.<\/p>\n<p>We\u2019ve addressed these problems. By packaging the object model\/client libraries as a NuGet package, they are much easier to consume in a build. You don\u2019t need to install them on a build machine, which would require administrative privileges. The <a href=\"http:\/\/www.microsoft.com\/net\/dotnet_library_license.htm\">license<\/a> now allows you to bundle these libraries with your application for redistribution. Please note that this does not change the requirement that the end user must have a TFS CAL in the case of Team Foundation Server. In the case of VSO, simply having access to an account is sufficient (i.e., each user on VSO is assigned a license in order to gain access, which is different than TFS). As an aside, you can read more about the changes we are making to TFS CALs and VSO pricing in <a href=\"http:\/\/blogs.msdn.com\/b\/bharry\/archive\/2015\/07\/27\/included-cals-and-tiered-pricing.aspx\">Brian\u2019s post<\/a>.<\/p>\n<p>As you can see <a href=\"https:\/\/www.visualstudio.com\/integrate\/get-started\/client-libraries\/dotnet\">here<\/a>, we\u2019ve released four packages. The descriptions aren\u2019t as helpful as I\u2019d like, and we are getting that fixed.<\/p>\n<p>First, I need to give you some context. We started building Team Foundation Server more than 12 years ago. Back then, <a href=\"https:\/\/en.wikipedia.org\/wiki\/SOAP\">SOAP<\/a> was the primary protocol for building web services. So, everything in TFS used SOAP, including version control, work item tracking, build, test case management, etc. Then a few years ago <a href=\"https:\/\/en.wikipedia.org\/w\/index.php?title=Representational_state_transfer&amp;redirect=no\">REST<\/a> started taking over. Very few web services are being built using SOAP today (I\u2019d say none, but I\u2019m sure someone would point on one I missed!). Also, REST web services are easier to consume in everything from Javascript to iOS apps. So it made sense for us to start moving our web services to REST.<\/p>\n<p>When we built SOAP web services, we declared them to be an internal implementation detail and that consumers would need to use our .NET client libraries or our <a href=\"https:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=47727\">Java SDK<\/a>. If you\u2019ve ever looked at the SOAP web services, you quickly see that they can be cryptic, and they were clearly designed by different teams given the dramatic differences between some of the different feature areas.<\/p>\n<p>When we made the decision to start building REST APIs, we decided we wanted to follow a different process to produce REST APIs that are consistent and easy to consume. We decided we\u2019d have a set of guidelines and a review process. We didn\u2019t want to create guidelines from scratch, so we adopted the guidelines the Azure team uses and gave them some feedback, which they incorporated. There\u2019s now a broader effort across the company to standardize REST guidelines.<\/p>\n<p>With an existing product like TFS, changing protocols is not a simple thing. The product contains lots of SOAP endpoints. All of the existing clients have to continue to work for years, as breaking changes become blockers for customers moving to newer versions of TFS or potential work stoppage issues with VSO since we update VSO constantly. REST is also very different than SOAP, so you can\u2019t just translate SOAP web services into REST (or you\u2019ll end up with something terrible). As a result, it\u2019s a gradual transition to move from SOAP to REST.<\/p>\n<p>With that context, here\u2019s a description of each package of .NET client libraries. Applications that use a wide range of features are likely to need more than one of these packages.<\/p>\n<ul>\n<li><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.TeamFoundationServer.ExtendedClient\/\">Microsoft.TeamFoundationServer.ExtendedClient<\/a> This package contains the traditional TFS\/VSO client object model that uses the SOAP API. You will need it to get full access to the work item tracking object model, version control, test management, and more. If you\u2019ve used the TFS\/VSO client object model in applications before, this is the one you\u2019ve used. Because not every API is available in TFS 2015 or VSO currently as a REST API, there are going to be cases where you must use this package. Similarly, there are new features that have been built with only REST APIs for which you will need the Client package.<\/li>\n<li>\n<div align=\"left\"><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.TeamFoundationServer.Client\/\">Microsoft.TeamFoundationServer.Client<\/a> Here you\u2019ll find convenient .NET wrappers for our REST APIs for build, team rooms, version control, test case management, and work item tracking. You can of course call the REST APIs directly without using this library. You will encounter cases where an API is not available in this package and have to also use the ExtendedClient package.<\/div>\n<\/li>\n<li>\n<div align=\"left\"><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.VisualStudio.Services.Client\/\">Microsoft.VisualStudio.Services.Client<\/a> If you need to access account, profile, identity, security, or other core platform services, you\u2019ll need this package.<\/div>\n<\/li>\n<li>\n<div align=\"left\"><a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.VisualStudio.Services.InteractiveClient\/\">Microsoft.VisualStudio.Services.InteractiveClient<\/a> This package provides the library necessary to show a user an interactive prompt for credentials to sign in. If you are using <a href=\"https:\/\/www.visualstudio.com\/en-us\/integrate\/get-started\/auth\/overview\">basic authentication<\/a>, <a href=\"https:\/\/www.visualstudio.com\/news\/2015-jul-7-vso\">personal access tokens<\/a>, or <a href=\"https:\/\/www.visualstudio.com\/en-us\/integrate\/get-started\/auth\/oauth\">OAuth<\/a>, you won\u2019t need this.<\/div>\n<\/li>\n<\/ul>\n<p>Here\u2019s a diagram showing the dependencies among the packages. NuGet will automatically handle the dependencies for you. For example, if you choose to use TeamFoundationServer.ExtendedClient, NuGet will pull in the other three automatically.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/39\/2019\/03\/3122.NuGetPackageDependency_3ED60406.png\"><img decoding=\"async\" title=\"NuGetPackageDependency\" style=\"padding-top: 0px;padding-left: 0px;padding-right: 0px;border-width: 0px\" border=\"0\" alt=\"NuGetPackageDependency\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/39\/2019\/03\/3146.NuGetPackageDependency_thumb_4E789FC8.png\" width=\"859\" height=\"338\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>NOTE<\/strong>: If you only need the REST APIs and choose to use TeamFoundationServer.Client, you\u2019ll want to use Services.InteractiveClient also if you need to allow users to log in interactively and thus add a reference to both NuGet packages (NuGet will then automatically get Services.Client for you).<\/p>\n<p>We have <a href=\"https:\/\/www.visualstudio.com\/en-us\/integrate\/get-started\/client-libraries\/samples\">a few samples<\/a> to get you going, and a <a href=\"https:\/\/www.visualstudio.com\/integrate\/api\/overview\">REST API reference<\/a> in addition to the traditional TFS\/VSO <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/bb130146.aspx\">client object model documentation<\/a>.<\/p>\n<p>One thing we\u2019ve never had is support for the <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/gg597391(v=vs.110).aspx\">Portable Class Library<\/a> (PCL). I\u2019m happy to say that we are working on that and will start adding PCL-compatible libraries as they become available.<\/p>\n<p>We are also working on adding a package for Team Explorer extensibility.<\/p>\n<p><strong>[Update 8\/18\/15]<\/strong> For using Git via an API, you\u2019ll need the <a href=\"https:\/\/www.nuget.org\/packages\/LibGit2Sharp\">LibGit2Sharp package<\/a>.<\/p>\n<p><strong>[Update 2\/27\/17]<\/strong><\/p>\n<p><strong>Using VSTS Libraries from .NET Core<\/strong><\/p>\n<div class=\"site-wrapper\">\n<article class=\"post tag-dotnet-core tag-vsts tag-rest-api\">\n<section class=\"post-content\">If you want to use the current versions of the <a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/integrate\/get-started\/client-libraries\/dotnet\">.NET wrappers<\/a> for the <a href=\"https:\/\/www.visualstudio.com\/en-us\/docs\/integrate\/api\/overview\">VSTS REST APIs<\/a> in a .NET Core application, you&#8217;ll need to add the following to your <code>*.csproj<\/code> file to allow NuGet to fallback to using PCLs based on profiles:<\/p>\n<pre><code>&lt;PropertyGroup&gt;  \n    &lt;PackageTargetFallback&gt;portable-net451+win8&lt;\/PackageTargetFallback&gt;\n&lt;\/PropertyGroup&gt;  <\/code><\/pre>\n<\/section>\n<\/article>\n<\/div>\n<p>See <a href=\"http:\/\/mitchdenny.com\/vsts-libraries-from-dotnet-core\/\">Using Visual Studio Team Services Libraries from .NET Core<\/a> for more details.<\/p>\n<p><em>Follow me at <\/em><a href=\"https:\/\/twitter.com\/tfsbuck\"><em>twitter.com\/tfsbuck<\/em><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For the past couple of releases we\u2019ve released the Team Foundation Server\/Visual Studio Online client object model as a downloadable installer (aka MSI). Additionally, the license for it did not include the right to package it in an application for redistribution. As a result, it was inconvenient for builds and added friction for installing an [&hellip;]<\/p>\n","protected":false},"author":94,"featured_media":10268,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[14,20],"class_list":["post-8561","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-tfs-2015","tag-visual-studio-team-services"],"acf":[],"blog_post_summary":"<p>For the past couple of releases we\u2019ve released the Team Foundation Server\/Visual Studio Online client object model as a downloadable installer (aka MSI). Additionally, the license for it did not include the right to package it in an application for redistribution. As a result, it was inconvenient for builds and added friction for installing an [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/posts\/8561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/users\/94"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/comments?post=8561"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/posts\/8561\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/media\/10268"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/media?parent=8561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/categories?post=8561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/buckh\/wp-json\/wp\/v2\/tags?post=8561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}