Ambiguous Reference System.Net.Http.Formatting - c#

I am using VS2015 .Trying to use System.Net.Http.Formatting gives me an error saying:
Severity Code Description Project File Line
Error CS0433 The type 'MultipartMemoryStreamProvider' exists in both 'System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and 'System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' aaAPIs C:\Working\Angular\aa\Controllers\Product\ImagesController.cs 22
How can I solve this?

Related

System.IO.Compression Reference issue

I am working on .NET framework 4.6 Web API application. My app is working on my machine and I was able to build it in my local but when I push it to our Azure Dev OPS CI, I got this build error.
Error CS0433: The type 'ZipArchive' exists in both 'System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
: Error CS0433: The type 'ZipArchiveMode' exists in both 'System.IO.Compression, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Process 'msbuild.exe' exited with code '1'.

The type 'MediaTypeHeaderValue' exists in both 'System.Net.Http"

please help,
I am getting following error when I am trying to access API endpoint:
Compiler Error Message: CS0433: The type 'MediaTypeHeaderValue' exists in both 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Net.Http, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Using statement in Cake

I am trying to use a using statement in Cake so that I can use the Regex class.
The line where I am trying to use this:
var matchesFromBranch = Regex.Matches(gitBranch, jiraPattern, RegexOptions.IgnoreCase).Select(m => m.Value).Distinct();
This gave me the following error:
.../build.cake(43,25): error CS0103: The name 'Regex' does not exist in the current context
.../build.cake(43,63): error CS0103: The name 'RegexOptions' does not exist in the current context
So I added using System.Text.RegularExpressions; to the top of my file. Now I get the following error:
.../build.cake(43,25): error CS0433: The type 'Regex' exists in both 'System.Text.RegularExpressions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
.../build.cake(43,63): error CS0433: The type 'RegexOptions' exists in both 'System.Text.RegularExpressions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Check in the tools/Cake folder and remove any references to the System.Text.RegularExpressions assembly and re run your bootstrapping script.
Even just delete the tools folder and re run the bootstrapper.

MySQLBackup in c#

How to solve this error ?
Error 1 Assembly 'MySqlBackup, Version=2.0.9.2, Culture=neutral,
PublicKeyToken=null' uses 'MySql.Data, Version=6.9.9.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d' which has a higher version than referenced
assembly 'MySql.Data, Version=6.3.6.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d' c:\Users\Mohammed Abdullah\Desktop\MySqlBackup.dll mobile_shop
Add reference to
MySql.Data
in you cs project

Cannot convert from type1 to type1 in netstandard error

I've been lured into creating NetStandard libraries in 2017RC. I have come across 2 bizarre errors
Error CS1503 Argument 1: cannot convert from 'UtilityLibrary.CountryHelpers.Country.CountryCode
[...UtilityLibrary\Country\Country.cs(10)]' to
'UtilityLibrary.CountryHelpers.Country.CountryCode [Common,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]'
Error CS0433 The type 'Regex' exists in both 'System.Text.RegularExpressions, Version=4.0.10.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'
After doing some searching, these are the things I've tried:
a clean of the entire solution and build
removing each project and re-adding them, setting the references after readding them
Why am I seeing the regex error? I literally just created a few libraries in one sitting!

Categories