Determining and changing the .NET version

If you get errors when using a .NET object in your application, you could have version issues. For example, many Microsoft system classes were added in .NET Version 2.0, including System.IO.DriveInfo and System.Net.NetworkInformation.Ping. For examples of these classes in applications, see Using .NET objects and Example: Using a .NET class directly, respectively.

Use the following function to get the current .NET version:

<cffunction name="GetDotNetVersion" returntype="string">  
    <cfset var seClass="">  
    <cfobject type=".NET" name="seClass" class="System.Environment">  
    <cfreturn seClass.Get_Version().ToString()>  
</cffunction>

If the function reports that the active version is not the one you require, install or reinstall the correct version of the .NET framework redistributable package on the system that runs ColdFusion. Then reinstall the ColdFusion .NET extension so that it uses the correct .NET version.