Getting existing .Net tools up and running in 2025

Getting existing .Net tools up and running in 2025

glandorf
Explorer Explorer
1,787 Views
6 Replies
Message 1 of 7

Getting existing .Net tools up and running in 2025

glandorf
Explorer
Explorer

Originally, I had already programmed some tools for AutoCAD 2010 in Visual Basic .Net and migrated them to the latest version every few versions over the years. However, I haven't really followed the development of programming for AutoCAD.

The tools that I programmed made our work easier in many cases. I'm probably not a particularly good programmer, but somehow I usually managed it. With the current version for 2025, I can only just get the example from Autodesk to work.

 

I had always used the wizard for the respective versions of Visual Studio, but apparently it no longer exists. In the past, the wizard usually only required me to enter the program path to the AutoCAD installation and I was able to start and debug AutoCAD directly from Visual Studio. How does it work with the 2025 version?

 

If I now click on debug in Visual Studio, I get the following message (translated from German)
“A project with the output type ‘Class library’ cannot be started directly. To debug the project, add an executable project to this solution ...”

Somewhere I have to enter the path to acad.exe but I can't find it in Visual Studio 2022 (version 17.10.0)

 

 

0 Likes
Accepted solutions (1)
1,788 Views
6 Replies
Replies (6)
Message 2 of 7

_gile
Consultant
Consultant

Hi,

 

You do not need any wizard. These wizards are mainly project templates and it is quite easy to create your own project templates for AutoCAD from a working project (see this topic). You can also start from these editable C# project templates.

 

Concerning AutoCAD 2025, there is a break in compatibility for .NET projects due to the fact that the .NET API now targets .NET 8.0 instead of the .NET Framework. You can try migrating your projects by following the step-by-step instructions in the attached files of this topic.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 3 of 7

ActivistInvestor
Mentor
Mentor

For setting the startup options, you can follow the instructions given here

0 Likes
Message 4 of 7

glandorf
Explorer
Explorer

Ok, after some back and forth and the holiday period, I finally got my project up and running.

However, I still have a problem in my source code that I need help with (even if it might not fit in here)

I have always used a file selection using Windows.Forms.SaveFileDialog. This type does not seem to be supported anymore, even if I try to include System_Windows_Forms as COM.

Dim fileDialog As New Windows.Forms.SaveFileDialog
0 Likes
Message 5 of 7

norman.yuan
Mentor
Mentor
Accepted solution

Not sure what do you mean by "...try to include System_Windows_Forms as COM..." (how?). But the code should be:

Dim fileDialog As New System.Windows.Forms.SaveFileDialog

 

Make sure your project file has this:

	<ItemGroup>
		<FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms" />
    </ItemGroup>

 And, you can see in the Solution Explorer window:

normanyuan_0-1722953150716.png

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 6 of 7

_gile
Consultant
Consultant

@glandorf  a écrit :

I have always used a file selection using Windows.Forms.SaveFileDialog. This type does not seem to be supported anymore, even if I try to include System_Windows_Forms as COM.

Dim fileDialog As New Windows.Forms.SaveFileDialog

The first "PropertyGroup" element of your project SDK have to contain this element:

<UseWindowsForms>true</UseWindowsForms>

So that your class can "import" System.Windows.Forms and the class should be decored with the SupportedOSPlatform attribute:

[SupportedOSPlatform("windows")]

 

PS: this works with C#, I do not know about VB...



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 7 of 7

glandorf
Explorer
Explorer

Thank you very much,

 

I had already made the entries mentioned in the project file and was in despair.

 

I only failed because of the "system". Previously I was able to write Windows.Forms.SaveFileDialog. Now it must be System.Windows.Forms.SaveFileDialogue

0 Likes