COBES0222 Invalid Framework target - SQL applications must be built to target the 4.0 .NET Framework.

Issue
When compiling an SQL application, you have specified the ILCLR compiler directive value as 2. SQL applications require that the SQL(ILCLR) compiler directive option be set to 4 to target .NET Framework version 4.0.
Resolution
Recompile the application, setting the ILCLR directive to 4.

Support for .NET Framework versions 3.0 and 3.5, and for the CLR v2 has been deprecated[3]. The option 2 of the ILCLR directive has also been deprecated.