views:

111

answers:

1

Is it possible to reference a .NET assembly from ColdFusion? If so, how can I accomplish this? I am not a ColdFusion developer by any means.

+10  A: 

You can call .net Assemblies directly since CF8.

Example:

<cfobject type=".NET" name="mathInstance" class="mathClass"
          assembly="C:/Net/Assemblies/math.dll">
<cfset myVar = mathInstance.multiply(1,2)>

or

mathInstance = CreateObject(".NET", "mathClass", "C:/Net/Assemblies/math.dll");
myVar = mathInstance.multiply(1,2);

CF8 Doc - Using Microsoft .NET Assemblies

CF9 Doc - Using Microsoft .NET Assemblies

JNBridgePro is used under the hood to make this possible. Reference: BlueDragon.NET versus CF8 .NET Integration: Architecture.

Henry