C# Binding Redirects – Finding and Detecting Assembly Version of Any DLL

Monday, November 30th, 2020

C# Binding Redirects – Finding and Detecting Assembly Version of Any DLL

When dealing with binding redirects, you may not know the newVersion value to use for a recently updated library.  The file version of the DLL is not necessarily the assembly version of the DLL, and when it comes to binding redirects, you must use the correct assembly version for a particular library. 

For example, in the web.config for one of our MVC projects we have the following:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f">
         <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2">
       </dependentAssembly>
    </assemblyBiding>
</runtime>

If we update the Antlr3.Runtime package to the latest version in the nuget package manager, our binding redirects may not be automatically updated. As such, we will have to update it manually ourselves with the correct newVersion assembly version value for the updated DLL. To find the assembly version, run this PowerShell script (updating the path to the DLL as necessary):

[Reflection.AssemblyName]::GetAssemblyName('C:\development\bin\Antlr3.Runtime.dll').Version

This is the version number that is needed for the updated binding redirect in the "newVersion" attribute.

Install VSFTPD 3.0.2 on the ARM Platform for Raspbian or Debian

Saturday, January 3rd, 2015

Install VSFTPD 3.0.2 on the ARM Platform for Raspbian or Debian

Download and install the arm compiled VSFTPD 3.0.2 deb package file and init script:

wget -N http://dinofly.com/files/linux/vsftpd_3.0.2_arm.tar.gz
tar -zxvf vsftpd_3.0.2_arm.tar.gz
if [ ! -e "/etc/init.d/vsftpd" ]; then
    sudo cp vsftpd /etc/init.d/
fi
sudo dpkg -i vsftpd_3.0.2-1_armhf.deb

Now, run these commands:

sudo useradd -d /var/ftp ftp
sudo mkdir -p /var/ftp
sudo chown root.root /var/ftp

Finally, start the VSFTPD service and set it to run on boot:

sudo service vsftpd restart
sudo update-rc.d vsftpd defaults

VSFTPD 3.0.2 should now be installed on your ARM device.

Install Latest Nvidia Drivers with a Custom Compiled Kernel in Ubuntu

Monday, February 18th, 2013

Installing Nvidia's Latest Drivers in Ubuntu using a Custom Compiled Kernel

I compiled the latest kernel 3.7.9 in my Ubuntu 10.04 Lucid following this guide here:  http://www.howopensource.com/2011/08/how-to-compile-and-install-linux-kernel-3-0-in-ubuntu-11-04-10-10-and-10-04/

Everything worked properly, but I ran into problems when attempting to install Nvidia's latest drivers (version NVIDIA-Linux-x86-310.32).  The DKMS build would not work and I received errors like "Unable to determine the target kernel version", "bad exit status 2", and "kernel header file does not exist" in the make.log file (along with others) in the /var/lib/dkms/nvidia folder.  The installer would always fail.  So, here's how to get the latest drivers installed and working properly with DKMS support.

First, we need to remove anything Nvidia that may already be installed.  There may be some Nvidia packages that are already installed on your system even though you've yet to install the Nvidia drivers!

Step 1: Download Nvidia Driver and Blacklist Other Drivers:

You can download the Nvidia drivers from http://www.geforce.com/drivers

Nvidia Drivers will only install if you are not running X, so you'll have to install this in a terminal.  Stop GDM before running the rest of the commands.

sudo service gdm stop

Now, we'll need to Blacklist some drivers.  To do this, launch a terminal, and use the following commands:

sudo nano /etc/modprobe.d/blacklist.conf

Add the following entries to the bottom of the file:

blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

Run the following command:

sudo apt-get --purge remove nvidia-*

Step 2: Creating Symbolic Links

For some reason, after compiling the latest kernel, the symbolic links the Nvidia installer relies on do not exist.  We'll need to create them.  Run the following commands in a terminal:

sudo ln -s /usr/src/linux-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-$(uname -r)/include/linux/version.h
sudo ln -s /usr/src/linux-$(uname -r) /usr/src/linux

Step 3: Prerequisites

Install the following prerequisites by running these commands:

sudo apt-get install dkms

Step 4: Run the Nvidia Installer

Now, run the Nvidia installer and the DKMS module should build.

sudo sh NVIDIA-Linux-x86-310.32.run

Or whatever version you downloaded.