Problem runing .dll (Visual Studio)

Problem runing .dll (Visual Studio)

julian.vallejo
Participant Participant
727 Views
5 Replies
Message 1 of 6

Problem runing .dll (Visual Studio)

julian.vallejo
Participant
Participant

Hello,

 

I program in VB, now I'm working to program from Visual Studio.

I'm starting with the typical "Hello World" program using:

-Windows 11 Business

-Visual Studio 2022

-AutoCad 2022.

-Creating new project in Visual Studio as VB. Class Library (.NET 6.0)

-ObjectARX_for_AutoCAD_2022_Win_64bit_dlm

 

I have notice  the diference with a old tutorial I need to reference AcCoreMgd so I can use "Commandmethod".

 Here it is the program:

julianvallejo_0-1657126347904.png

 

The configuration:

julianvallejo_1-1657126393531.png

julianvallejo_2-1657126426002.png

 

Finally, this is the log of the autocad when y try to load de dll.

julianvallejo_3-1657126556052.png

 

Any idea how can I resolve this issue?


Thank your for you support.

 

Accepted solutions (2)
728 Views
5 Replies
Replies (5)
Message 2 of 6

norman.yuan
Mentor
Mentor
Accepted solution

When working with AutoCAD .NET API, you must use MS .NET Framework, not .NET Core (that is, .NET 5 or .NET 6, which is different from .NET framework!).

 

You can use the latest .NET Framework (4.8) for later versions of AutoCAD (at least since ACAD2019, but would work with even older version of AutoCAD, as long as the computer has .NET framework 4.8 installed).

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 6

julian.vallejo
Participant
Participant

Thank your for your response. 

 

.NET 4.8 is not listed as a target framework when creating a new project in Visual Studio 2022.

It was a list that looks like this one (this image is from visual studio 2019):

In the 2022 version I had these ones and 5.0 and 6.0. But none of them worked.

julianvallejo_0-1657211308783.png

 

I have tried installing visual studio 2019 and working with .NET standard 2.0 and it works.

It is any problem if continue with 2019 version and .NET 2.0? Or it is better to avoid future issues to install again 2022 version and try to resolve the issue with the .Net Framework?

 

Thank you again for your support.

0 Likes
Message 4 of 6

julian.vallejo
Participant
Participant

Sorry, I forget to explain that looking in visual studio installer, .NET 4.8 was installed. Nevertheless, It was when I was creating a new project when I couldn't take the option of the 4.8 version.

0 Likes
Message 5 of 6

norman.yuan
Mentor
Mentor
Accepted solution

No, you DO NOT use .NET Standard/Core/5/6. You use ONLY .NET Framework 4.x (should be 4.8, if you only target very newer versions of AutoCAD). It does not matter you are using VS2019 or 2022. Make sure your installation of VS has latest .NET framework development components available.

 

Again, .NET Framework, not .NET standard, not .NET Core, .NET 5/6. The reason your project does not show .NET framework is probably you have chosen a wrong class library project template. In VS2022, when start new project, you select "Class Library (.NET Framework)", not "Class Library", which then ask you select .NET standard/.NET5, .NET6 (that was where you were wrong!).

 

Norman Yuan

Drive CAD With Code

EESignature

Message 6 of 6

julian.vallejo
Participant
Participant

Thank you. I was starting the wrong class library.

0 Likes