Solution for .NET error: The type ‘HttpResponseMessage’ exists in both ‘System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ and ‘System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’

Got this error when building a .NET framework (version 4.6.1) solution containing multiple projects:

My solution:
Install System.Net.Http version 4.0.0 as nuget package to the “failing project”.

Added this to the “failing” project app.config file:

Updated the “failing” projects .csproj file like this:
Removed this line or similar for System.Net.Http:

Added “hintpath” with projects relative path to the nuget packages.
In my example its 3 level up and then down (..\..\..) you might need to adjust to your projects folderstructure.

Voila.

Most Complete MSTest Unit Testing Framework Cheat Sheet

 

Source: Most Complete MSTest Unit Testing Framework Cheat Sheet

Seq — centralized structured logs for .NET, Java, Node.js

Application logs are the most useful data available for detecting and solving a wide range of production issues and outages. Seq makes it easier to pinpoint the events and patterns in application behavior that show your system is working correctly — or why it isn’t.

Seq is built for modern structured logging with message templates. Rather than waste time and effort trying to extract data from plain-text logs with fragile log parsing, the properties associated with each log event are captured and sent to Seq in a clean JSON format. Message templates are supported natively by ASP.NET CoreSerilogNLog, and many other libraries, so your application can use the best available diagnostic logging for your platform.

Seq accepts logs via HTTPGELFcustom inputs, and the seqcli command-line client, with plug-ins or integrations available for .NET Core, Java, Node.js, Python, Ruby, Go, Docker, message queues, and many other technologies.

Free for development and single-user deployment
The free single-user license included with Seq lets developers run Seq locally, and now supports individual developers in production.

Source: Seq — centralized structured logs for .NET, Java, Node.js

c# – sgen.exe fails during build – Stack Overflow

After adding a new 3rd party reference to a project and then building for Release configuration I got this error (not present when in debug build):
Error Could not load file or assembly ‘x’ or one of its dependencies. The system cannot find the file specified. SGEN  

Here is a solution that worked for me:

If you are having this problem while building your VS.NET project in Release mode here is the solution: Go to the project properties and click on the Build tab and set the value of the “Generate Serialization Assembly” dropdown to “Off”. Sgen.exe is “The XML Serializer Generator creates an XML serialization assembly for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types.” (MSDN)

Source: c# – sgen.exe fails during build – Stack Overflow

NLog vs log4net vs Serilog: Compare .NET Logging Frameworks

Logging information in .NET, or really in any production application, is invaluable. In many cases, developers don’t have direct access to the production environment to debug issues. Good quality logs are the difference between solving problems like Sherlock Holmes and stumbling upon solutions like Inspector Jacques Clouseau. As you can imagine, we’re pretty big on logging here at Stackify, and we’ve written quite a few other blog posts on .NET logging frameworks. I’d encourage you to try out the search and read a few of our previous articles.

Source: NLog vs log4net vs Serilog: Compare .NET Logging Frameworks

Log4View – log4net log viewer

Log4View is a powerful and comfortable viewer for log4net, NLog, log4j and log4xx

Log4View Community Edition is free to use. 

Log4View comes in three different editions:

  • Log4View Professional Edition is the most complete edition of Log4View. It can handle up to 255 different log sources simultaneously, can read input from databases and visualizes log messages as text and chart.
  • Log4View Trial Edition has the same features as Log4View Proferssional Edition but expires 30 days after installation. After expiration, the Trial Edition continues working as Community Edition.
  • Log4View Community Edition is limited to one log source, has no access to databases and can’t visualize log messages as chart. Log4View Community Edition is free for personal, non commercial use.

Download: Log4View – LOG4VIEW – created by PROSA