Fixing .NET build ILMerge task to correctly locate .NET 4.0 reference assemblies

Using assemblies merged using ILMerge built on a machine with .NET 4.5
installed without specifying the referenced assemblies directory for .NET
4.0 can lead to problems. Fixes issue #5257.
Bumping .NET version numbers to 2.31.1 for hotfix release