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.
Related
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'.
I am using Bridge.net v17.10.1, and according to the documentation they are implemented in Bridge.Core.
HashSet<T> varName;
Stack<T> varName2;
Produces the following errors:
Error CS0433 The type 'HashSet<T>' exists in both 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'Bridge, Version=17.6.0.0, Culture=neutral, PublicKeyToken=null'
Error CS0433 The type 'Stack<T>' exists in both 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'Bridge, Version=17.6.0.0, Culture=neutral, PublicKeyToken=null'
Probably something super simple, but my Bridge.Net knowledge is limited and I have not been able to figure it out.
This is a known issue, the answer is described here: https://forums.bridge.net/forum/community/help/2902-c-compile-error-the-type-stopwatch-exists-in-both-system-and-bridge
Yes, you have to remove System reference from your csproj file
Also I can suggest to add the following reference to prevent adding System reference by Visual Studio
<Reference Include="System" Condition="False" />
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'
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?
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!