Posts

The specified version string contains wildcards, which are not compatible with determinism.

Image
With some versions of Visual studio when you try to make version auto number sometimes it get an error like : Error CS8357 The specified version string contains wildcards, which are not compatible with determinism. Either remove wildcards from the version string, or disable determinism for this compilation Solution : Unload Project from visual studio and edit .csproj file Or open .csproj solution file in editor. Search for tag and Change value from true to false Save file and reload project again inside Visual studio <propertygroup> <configuration condition=" '$(Configuration)' == '' ">Debug</configuration> <platform condition=" '$(Platform)' == '' ">AnyCPU</platform> <projectguid>{76602FA1-9AD8-4014-BA5D-2E9128C19AB2}</projectguid> <targetframeworkversion>v4.7</targetframeworkversion> <filealignment>512</filealignment> <a

Get Credit Card Type

How to get C-card type, how to know the input card number is Visa or Master Card ? here the code for CreditCard.cs public class CreditCard { private string AmericanExpressPattern => @"^3[47][0-9]{13}$"; private string MasterCardPattern => @"^5[1-5][0-9]{14}$"; private string VisaCardPattern => @"^4[0-9]{12}(?:[0-9]{3})?$"; private string DinersClubCardPattern => @"^3(?:0[0-5]|[68][0-9])[0-9]{11}$"; private string EnRouteCardPattern => @"^(2014|2149)"; private string DiscoverCardPattern => @"^6(?:011|5[0-9]{2})[0-9]{12}$"; private string JcbCardPattern => @"^(?:2131|1800|35\d{3})\d{11}$"; private Dictionary CreditRegxs { get; set; } public CreditCard() { CreditRegxs = new Dictionary () { {"American Express",AmericanExpressPattern}, {"Mastercard",MasterCardPattern}, {"Visa&q

Serialization File Error Could not load file or assembly mscorlib.XmlSerializers

When serializing an XML file, an error occurs in the following manner: XmlSerializer serializer= new XmlSerializer(typeof(MyType)); Errors such as : The assembly with display name 'mscorlib.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'mscorlib.XmlSerializers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. use the following line to solve it:  XmlSerializer lizer = XmlSerializer.FromTypes(new[] { typeof(MyType) })[0];

Error "The operation can not be performed Because the message Has Been changed"

Being of the email changes saved, then the execution of the mail Save () method, you may experience the error   "The operation can not be performed Because the message Has Been changed."  Especially if you go to edit multiple email. This is due to the object  Microsoft.Office.Interop.Outlook.UserProperty  that was not released.   So before the save is to be performed education System.Runtime.InteropServices.Marshal.ReleaseComObject (UserProperty). At this stage the previous post snippet becomes   public void AddCustomPropertyToMail (entryID string, string propertyName, string value) { Microsoft.Office.Interop.Outlook.MailItem mail = Globals.ThisAddIn.Application.Session.GetItemFromID (entryID) as Microsoft.Office.Interop.Outlook.MailItem; if (email! = Null) { Microsoft.Office.Interop.Outlook.UserProperty UserProperty = mail.UserProperties.Add (propertyName, Microsoft.Office.Interop.Outlook.OlUserPropertyType.olText); UserProperty.Value = value; Syst

OCR text detection with google APIs C#

Image
After searching more than 3 hrs to know how to implement text detection using google API i decided to write this post, hope it help c# developer to know how to use and implement Vision API, Source Code :  https://github.com/msm2020/OCR-google-APIs 1- Create server key on google console Go to http://console.developers.google.com/ and create new project or use existing project From Overview page enable vision API You need to create new bill information to use vision API, it's fully free for 1st 1000 request/ month you can check https://cloud.google.com/vision/docs/pricing After Enable Google Cloud Vision API go to Credentials page and create new server key Create key by fill all requested data and download Json file 2- Create Visual studio project I'll use vs 2015 and .NET framework 4.5 Add google Nuget packages : Google.Apis.Vision.v1 by right click on project and then manage nuget

How to set dynamically height/width of an external image in rdlc report?

It seems that there is no way to dynamically set the height and width of an external image used in rdlc report, but here a workaround to make it possible Add image to you Report On the image properties, set it to use External image source and use a report parameter to set which image to use On image, set "keep original size" Edit: You may also generate such "padding image" dynamically to allow different widths, for example: public void GenerateReport(int width, int height) { var image =Bitmap.FromFile("your image path"); //you can use stream or other way to get the image using (var g = Graphics.FromImage(image)) { g.Clear(Color.Transparent); g.FillRectangle(new SolidBrush(Color.Transparent), 0, 0, width, height); // here will change the size to fit in report } MemoryStream ms = new MemoryStream(); image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); // and pa

Compiler Error Message: CS0433: The type 'Microsoft.Reporting.WebForms.ReportDataSource' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\Microsoft.Report

The solution to this problem need to go to web.config file and delete these four lines: <add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>