I'm using Tangible Engineering's "T4 Editor" which, while still a bit flawed, is a pretty good T4 editor and, while configuring a T4 template that uses the WebApi Client, it continues to show the following message:
"$(SolutionDir)packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll could not be loaded. There was an exception during load: A dependency could not be found!"
I have searched the NuGet repository entry for the package, traced all of the "Dependencies" links, added the corresponding assemblies via "assembly" entries that precede the problem entry and yet I continue to receive the error. As can be seen in the code below, I've thrown everything in but the kitchen sink to no avail. A little guidance here would go a long way. My environment is Visual Studio 2013 Premium, ReSharper, PowerTools and, of course, Tangible's T4 editor (a free version can be downloaded for those of you that want to try it and replicate the error and, no, I don't work for them nor do I receive compensation from them for recommending it - I just like it). Below is the template:
<#@ template debug="true" hostSpecific="true" language="C#" #>
<#@ CleanupBehavior Processor="T4VSHost" CleanupAfterProcessingTemplate="true" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Data" #>
<#@ assembly name="System.Xml" #>
<#@ assembly name="System.Xml.Linq"#>
<#@ assembly name="System.Configuration" #>
<#@ assembly name="EnvDTE"#>
<#@ import namespace="System" #>
<#@ import namespace="System.Data"#>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Xml" #>
<#@ import namespace="System.Xml.Linq" #>
<#@ import namespace="System.Globalization" #>
<#@ import namespace="System.Reflection" #>
<#@ import namespace="System.CodeDom" #>
<#@ import namespace="System.CodeDom.Compiler" #>
<#@ import namespace="Microsoft.CSharp"#>
<#@ import namespace="System.Text"#>
<#@ import namespace="System.Configuration" #>
<#@ output extension=".generated.cs" #>
<#@ assembly name="System.Threading" #>
<#@ import namespace="System.Threading" #>
<#@ import namespace="System.Threading.Tasks" #>
<#@ assembly name="System.Collections" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ assembly name="System.Runtime.Serialization"#>
<#@ assembly name="$(SolutionDir)packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll" #>
<#@ assembly name="$(SolutionDir)packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.Tasks.dll"#>
<#@ assembly name="$(SolutionDir)packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll"#>
<#@ assembly name="$(SolutionDir)packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll"#>
<#@ assembly name="$(SolutionDir)packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll"#>
<#@ assembly name="$(SolutionDir)packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll" #>
<#@ assembly name="C:\AoCTools\AoCFramework\AoC.AoCTools.T4CodeGenerationCmn.dll" #>
<#@ assembly name="C:\AoCTools\AoCFramework\AoC.AoCTools.T4CodeGeneration.dll" #>
<#@ import namespace="AoC.AoCTools.T4CodeGeneration" #>
<#@ import namespace="AoC.AoCTools.T4CodeGenerationCmn" #>
Thought I'd toss a relatively applicable answer in here. Turns out that the T4 gadget is a bit remiss when attempting to fetch packages from the GAC. It will fetch standard GAC stuff just fine, but some of the extensions that are provided are not found.
If those packages that are "missing" are just copied into the directory where everything else is being looked for (unique packages from your own library, a third party library that has other dependencies, etc.) and include everything, that "error" should go away. Not saying this is the definitive answer, but it will help in certain circumstances.