繁体   English   中英

无法加载文件或程序集'System.Net.Http,Version = 4.1.0.0 .net framework 4.6 .net standard 1.3

[英]Could not load file or assembly 'System.Net.Http, Version=4.1.0.0 .net framework 4.6 .net standard 1.3

我正在尝试在我的项目中调用Watson对话API。 我有一个.net核心项目(包含IBM.WatsonDeveloperCloud软件包),我将目标框架手动更改为.csproj文件中的net46和netstarndard1.3。 这是.csproj文件:

  <Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <VersionPrefix>1.1.0</VersionPrefix>
    <AssemblyName>IBM.WatsonDeveloperCloud.Conversation.v1.Example</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageId>IBM.WatsonDeveloperCloud.Conversation.v1.Example</PackageId>
    <RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
    <TargetFrameworks>net46;netstandard1.3</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="IBM.WatsonDeveloperCloud" Version="1.1.0" />
    <PackageReference Include="IBM.WatsonDeveloperCloud.Conversation.v1" Version="1.1.0" />
    <PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
    <PackageReference Include="System.Net.Http" Version="4.1.0" />
  </ItemGroup>

</Project>

当我运行项目时,出现以下错误:

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'

解决方案资源管理器在Dependencies-> SDK下显示System.Net.Http(4.1.0)

任何评论表示赞赏。

确保您的Web.config文件中没有任何奇怪的绑定重定向。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM