Why am I getting ‘Assembly ‘*.dll’ must be strong signed in order to be marked as a prerequisite.’?

My guess is that you’re not working with strongly named assemblies. I’ve had this error when two projects reference slightly different versions of the same assembly and a more dependent project references these projects. The resolution in my case was to remove the key and version information from the assembly name in the .csproj files … Read more

Can a Byte[] Array be written to a file in C#?

Based on the first sentence of the question: “I’m trying to write out a Byte[] array representing a complete file to a file.” The path of least resistance would be: Documented here: System.IO.File.WriteAllBytes – MSDN

Unable to determine the principal end of an association between the types

That exception is launched because you are trying to configure an one-to-one relationship but you are not specifying which end is the principal in the relationship. Principal end is the one which will be inserted first and which can exist without the dependent one. Dependent end is the one which must be inserted after the principal because it has foreign key to the … Read more

Print Pdf in C#

A very straight forward approach is to use an installed Adobe Reader or any other PDF viewer capable of printing: Another way is to use a third party component, e.g. PDFView4NET

How can we prepend strings with StringBuilder?

Using the insert method with the position parameter set to 0 would be the same as prepending (i.e. inserting at the beginning). C# example : varStringBuilder.Insert(0, “someThing”); Java example : varStringBuilder.insert(0, “someThing”); It works both for C# and Java

The name ‘ViewBag’ does not exist in the current context – Visual Studio 2015

I had this issue despite having all the correct configuration. It turned out to be some bad files in the Component Cache, preventing the Razor views from recognising ViewBag, Model, and HtmlHelpers. Deleting these files solved the problem (good versions of these files were created next time I opened Visual Studio). The files are located … Read more

need implement C# Counter

I want to make increment and decrement counter. There are two buttons called X and Y. If first press X and then press Y counter should increment. If first press Y and then press X counter should decrement. I am not familiar with c#. So can anyone help me please ?? 🙁