![](/img/trans.png)
[英]Could not load file or assembly 'System.Net.Http, Version=4.1.1.1 .Net Standard
[英]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.