dotnet-standard-sdk: [speech-to-text] System.Net.Http conflict
When I build my project, I get the following warning:
Severity Code Description Project File Line Suppression State Warning MSB3243 No way to resolve conflict between “System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” and “System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”. Choosing “System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” arbitrarily. SliqSpeechToTextCore C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets 1964
When I run, I get this exception when I try to instantiate the service by calling new SpeechToTextService()
System.IO.FileLoadException: ‘Could not load file or assembly ‘System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)’
My csproj is
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PackageTargetFallback>dnxcore50;portable-net45+netcore45+wp8+wp81+wpa81;</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IBM.WatsonDeveloperCloud.SpeechToText.v1" Version="1.0.0" />
</ItemGroup>
</Project>
I tried installing System.Net.Http from NuGet but it didn’t help.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 48 (15 by maintainers)
Finally I solved this problem by
This worked for me…
This information might help someone. I was receiving this exception while instantiating SpeechToTextService class. - System.Security.VerificationException: ‘Method System.Net.Http.CloneableExtensions.Clone: type argument ‘System.Net.Http.Headers.MediaTypeHeaderValue’ violates the constraint of type parameter ‘T’.’
Resolution - Updating System.Net.Http nuget version to 4.3.3 resolved the issue for me.
@fmarsland Can you please try installing
@AnjuAlphonsa Thank you, this worked for me!
Any update on this?
I get this issue when instantiating the ConversationService.
Is there a fix for this yet? Perhaps a workaround? Have been researching a bit, and seems like this is a common issue when working with .NET Standard and normal .NET Framework. .NET Core does not have this issue when working with .NET Standard.
Perhaps could be worth it to rewrite this library in .NET Framework? Shouldn’t be hard since is the same code.
@atilatosta
Try to check the nuget package and update everything or update at least System.Net.Http.Formatting. It solve the issue for me. Similar to what @vyarovoy did.
@ratans hey guys! we are actively working on it. I believe I’m having problems signing the assembly. I soon hope to solve.