C# &引用;系统找不到指定的文件";对于不同于I';我指定
在我的csproj中,我有C# &引用;系统找不到指定的文件";对于不同于I';我指定,c#,.net,visual-studio,msbuild,nuget,C#,.net,Visual Studio,Msbuild,Nuget,在我的csproj中,我有 <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Ne
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
<Private>True</Private>
</Reference>
..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll
真的
当我对该程序集中的类运行单元测试时,我得到
System.IO.FileNotFoundException:无法加载文件或程序集
'System.Net.Http.Formatting,版本=5.2.2.0,区域性=中性,
PublicKeyToken=31bf3856ad364e35'或其依赖项之一。这个
系统找不到指定的文件
知道为什么会出现这种不匹配吗?注意,当您引用5.2.3.0时,异常表明缺少的版本是5.2.2.0 您可能有另一个引用5.2.2.0的依赖项。 您可以将重定向作为app.config文件添加到测试项目中,以实现更高版本:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
请注意,当您引用5.2.3.0时,该异常表示缺少的版本是5.2.2.0 您可能有另一个引用5.2.2.0的依赖项。 您可以将重定向作为app.config文件添加到测试项目中,以实现更高版本:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
取决于程序集和/或单元测试实现它的内容/方式。从错误判断,您的单元测试项目是否引用了System.Net.Http.Formatting
?附加说明:它现在是的一部分。Hth.在NuGet Package Manager中,Consolidate
?@问卷下列出的库是否已尝试将NuGet PackageMicrosoft.AspNet.WebApi.Client.5.2.3
添加到单元测试项目中?此问题有任何更新吗?你解决这个问题了吗?如果没有,请告诉我有关此问题的最新信息?取决于程序集和/或单元测试实现它的方式。从错误判断,您的单元测试项目是否引用了System.Net.Http.Formatting
?附加说明:它现在是的一部分。Hth.在NuGet Package Manager中,Consolidate
?@问卷下列出的库是否已尝试将NuGet PackageMicrosoft.AspNet.WebApi.Client.5.2.3
添加到单元测试项目中?此问题有任何更新吗?你解决这个问题了吗?如果没有,你能告诉我关于这个问题的最新信息吗?