Reputation: 51
My company has a web application written in ColdFusion and I am trying to integrate an API that is written in C#.Net. I am fairly new to .Net development so I may not be great with terminology. I have created a very simply C# class to test with ColdFusion which is defined below:
namespace FIX
{
public class IntegersTest
{
public int Add(int n, int m)
{
return n + m;
}
}
}
I am able to build this class and a .dll is output (FIX.dll). Now I create a ColdFusion file with the following code:
<cfobject type="dotnet" class="FIX.IntegerTest" name="math" action="create"
assembly="C:\path\to\file\FIX.dll">
When I try to run this I get the following error:
Class FIX.IntegerTest not found in the specified assembly list.
The assembly that contains the class must be provided to the assembly attribute.
And in the dotnet error logs I see "Aborting proxy generation as no classes were found in dependent class list. This might mean that the class FIX.IntegerTest was not present in the assembly."
I've tried reinstalling the ColdFusion .Net Service as well as ColdFusion itself. I tried targeting .Net Framework 3.0 and re-building the class. I've tried multiple variations for the class attribute of the cfobject tag. I'm not quite sure what else to do.
Something to note is that the following ColdFusion code does not give an error:
<cfobject type="dotnet" name="sidiClass" class="System.IO.DriveInfo">
I am using Visual Studio 2019, ColdFusion 2018, and have set my target framework to .NET 4.7.2 for my test project. Any and all input would be appreciated! Thank you.
EDIT As pointed out by @Ageax I had just made a typo, but I was getting this for another class even though I made sure the spelling was correct. The answer was the target framework. ColdFusion didn't like that I was targeting .Net Framework 3.0 (This second project wasn't letting me switch to 4.0+ for some reason). I created a new project with the proper target framework and all seems to be working !
Upvotes: 3
Views: 341
Reputation: 51
As pointed out by @Ageax I had just made a typo, but I was getting this for another class even though I made sure the spelling was correct. The answer was the target framework. ColdFusion didn't like that I was targeting .Net Framework 3.0 (This second project wasn't letting me switch to 4.0+ for some reason). I created a new project with a proper target framework (4.7.2) and all seems to be working !
Upvotes: 2