Author Topic: CommandMethod not recognized  (Read 294 times)

0 Members and 1 Guest are viewing this topic.

mastrolube

  • Mosquito
  • Posts: 3
CommandMethod not recognized
« on: March 22, 2021, 06:14:58 AM »
Hello everyone!
I've a problem running .dll I made.. I'm following a course on udemy, but for me it doens't load anything.. Anyone can tell me what's the problem?
I've a solution with that class:
Code: [Select]
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
[code]
namespace ControlsDemo
{
    class ControlsDemoUtil
    {
        [CommandMethod("Test")]
        public void Demo()
        {
            MainForm mf = new MainForm();
            mf.Show();
        }
    }
}

when I load the DLL with netload, keyword "Test" is not recognized (It's not even there!)
I compiled using as references AcCoreMgd, AcDbMgd and AcMgd with version 23.1 (I'm running Autocad 2020)
I don't understand what I'm missing, I already did a DLL following the AutoCAD tutorial and this worked just fine (it was a while ago..).
I don't get where this simple few rows code fails.. If I don't find out Iill not able to go ahead with the tutorial .... :(

huiz

  • Swamp Rat
  • Posts: 885
  • Certified Prof C3D
Re: CommandMethod not recognized
« Reply #1 on: March 22, 2021, 06:56:08 AM »
Your class should be public, I think.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

Hanauer

  • Mosquito
  • Posts: 5
Re: CommandMethod not recognized
« Reply #2 on: March 23, 2021, 08:08:04 AM »
Did you select the correct .NET version?
For AutoCAD 2020: .NET Framework 4.7.

CADbloke

  • Bull Frog
  • Posts: 327
  • Crash Test Dummy
Re: CommandMethod not recognized
« Reply #3 on: March 26, 2021, 06:09:04 AM »
@huiz is right. A class is internal by default unless you declare it public. Command classes and methods must be public. The public method in the internal class can only be internal, its access is restricted by the access level of the class.