Hey All,
I'm hoping this can be an easy fix for some of you experts. I'm by no means totally proficient with C#/.NET/Visual Studio yet. Trying to get better. Anyways...
In short.. Trying to create a Lisp Function via .NET (C#). I've created some Lisp Functions via this API in the past, but now that I've switched over to Civil 3D I can't seem to get something right?
I have a SIMPLE method / function:
using System; using System.Windows; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Runtime; namespace Test { public class Testing { [LispFunction("test")] public static void RunTest(ResultBuffer rbArgs) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Hello World!"); } } }
There are no build errors:
I believe I have all the correct dependencies referenced:
Yet, when I run the function, it does not exist:
Please can I get some advice to get over this hurdle?
...About:
Best,
~DD
Solved! Go to Solution.
Solved by norman.yuan. Go to Solution.
Correct, they are all set to "No".
I think you started a wrong project type with your Visual Studio (2022, it looks to me). I tell this from 2 pictures you attached in your post.
1. The picture in your first post showing the references, it shows as "Dependencies", rather than "References" a it is supposed to be;
2. The picture attached to your reply to @_gile shows "Copy Local" to "No", rather "False" as it is supposed to be.
These 2 things indicate that you have chosen the project as .NET Core (.NET5/6), rather than .NET framework (4.7x/8). AutoCAD .NET API CAN ONLY work with .NET Framework, not .NET Core/5/6. You need to recreate your class library project as .NET Framework class library.
You are exactly correct. I did not know that. Thank you very much!
Best,
~DD
Can't find what you're looking for? Ask the community or share your knowledge.