C# How make a dll

C# How make a dll

DRossger
Advocate Advocate
4,357 Views
15 Replies
Message 1 of 16

C# How make a dll

DRossger
Advocate
Advocate

Hi!

 

I wondering to get dll from cs: Can somebody tell me how compile a C#-code in a dll-file. I know for using Visual Studio 2010 goes automatically. But is there another way?

 

Sorry I´m absolut beginners in c#

0 Likes
4,358 Views
15 Replies
Replies (15)
Message 2 of 16

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

what ide do you use if not VisualStudio?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 16

DRossger
Advocate
Advocate
Visual C# express and visual studio trial
version
Grüsse nach Österreich. Nicht mehr gesehen auf cad.de
0 Likes
Message 4 of 16

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

there are more intro-helps for vb.net, e.g. >>>this link<<< does a detailed description for first apps with VB.NET

 

>>>here<<< you find a video created by Fenton Webb (one of the AutoCAD development gurus), it starts at "Hello World" and goes deeper and deeper, at least a great introduction.

 

HTH; - alfred -

 

PS: Danke für die Grüße 😉

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 5 of 16

_gile
Consultant
Consultant

Hi,

 

You can have a look at AutoCAD.Net Training.zip, (both C# and VB).

You'll find a C# version of "My First Plug-in Training" codes here.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 6 of 16

dgorsman
Consultant
Consultant

"Sorry I´m absolut beginners in c#"

 

Don't forget the basic C# tutorials in the Visual Studio help and the examples scattered through the MSDN online help.  Those should give you a good grounding in the basics which are essential prior to tackling the AutoCAD interface.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 7 of 16

DRossger
Advocate
Advocate

Great stuff to learn c#. What´s the diffrent between Visual C# 2010 Express and Visual Studio 2010. Must I buy licens for using C# on Autocad workflow or it´s enough to begin with Express version. The dll-file som creates in Visual Studio from your C#-project I need later for appload in Autocad. Questions is can I get dll-file also from C#Express applikation.

Thanks for your help.

-Dirk-

0 Likes
Message 8 of 16

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> What´s the diffrent between Visual C# 2010 Express and Visual Studio 2010

Price 😉

And with VS2010 you can develop with more than one language, some options are missing in Express ... that you don't really need (within the first months or years) if you have an template solution to start (available for downloads on multiple places).

Some differences are listed >>>here<<<.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 9 of 16

kerry_w_brown
Mentor
Mentor

 

For a little more comprehensive resolution

 

http://lmgtfy.com/?q=difference+visual+studio+express+and+professional+%2B+Autocad


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 10 of 16

dgorsman
Consultant
Consultant

Something thats buried a little deeply in the features is the fact that Microsoft explicitly allows users to use the free Express editions to create software for production work or even sale, as long as they aren't building a clone of Microsofts major products.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 11 of 16

DRossger
Advocate
Advocate

What does it mean "clone of Microsofts major products"

For run Autocad Applikation on C sharp first step: build referens for ACDBMGD.DLL and ACMGD.DLL

number two: using method

 

using System;
using System.Runtime.InteropServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using acadApp = Autodesk.AutoCAD.ApplicationServices.Application;

public class HelloWorld
{
  [Autodesk.AutoCAD.Runtime.CommandMethod("HELLO")]
  public void HelloCommand()
  {
    acadApp.DocumentManager.MdiActiveDocument.Editor.WriteMessage(_
      "Hello World FROM C#!");
    acadApp.UpdateScreen();
  }
}

 

Than I do debugging cs-format (it means also compile cs ->exe). But I want to have a dll to can load program in Autocad workflow. In Visual Studio produce automatically dll you can find in c:\...\ClassLibrary\bin\Debug\ if you starting your library with extern program and load acad.exe. But it´s not possible to do with Express. The reason is I don´t know why I should buy Visual Studio if all functions I can also do with Express. Can somebody explain how I can do a dll from cs file with Visual Express ?

 

/Dirk

0 Likes
Message 12 of 16

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> What does it mean "clone of Microsofts major products"

E.g. that you don't use Microsoft's Visual Studio but >>>cSharp<<< instead. I think you already found it.

 

>> For run Autocad Applikation on C sharp first step: build referens for ACDBMGD.DLL and ACMGD.DLL

Sorry no. The fist step is to create a project, and the type of project has to be a DLL:

 

 

 

Check this first steps, then you can set the debug-options that when starting debugging the ACAD.EXE is started and you are able to netload your DLL now.

 

 

 

Good luck, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 13 of 16

kerry_w_brown
Mentor
Mentor

@DRossger wrote:

 

C# How make a dll

< .. > 

Sorry I´m absolute beginners in c#


If that is the case, don't try to build AutoCAD plugin's without learning the basics

of C# ( and .NET) first.

There are tons of C# tutorials available on the net that you can start with

and use to become familiar with the language.

 

Watch a couple of the AU videos related to programming.

 

Download the labs from AutoDesk ( 7 sessions) and work your way through those.

 

Read the forums ... there are several that have a great collection of code and AutoCAD related posts.

 

In short, you have to do the work to get the results.

 

Regards

Kerry

 

 

edit : added -  there are some references here that may be handy for you:

http://www.theswamp.org/index.php?topic=32381.0

 

 

 

 

 

 


 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 14 of 16

DRossger
Advocate
Advocate

Thanks Alfred, yes we comes nearly to my solutions. Take a look on second picture, the is register "Debuggen" . I can´t load Exeternal program ... acad.exe I can't find this opportunity in Visual Express. That is the reason for Autocad library is unusable with Visual Express (you can´t produce dll) or?

Sorry for my english, I´m not very well to describe thing in it.

 

@Kerry you´re right I am already 5 steps further.

0 Likes
Message 15 of 16

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

Sorry first about mentioning the wrong word for the alternative to MS-Visual Studio, it's name is SharpDevelop (>>>Wikipedia<<<).

And my screenshots (thinking of you are searching for and using an alternative) were done with SharpDevelop (4.2).

 

>> the is register "Debuggen" . I can´t load Exeternal program

That makes me thinking that you either use VS-Express (and not an alternative) or your project type is an EXE.

For VS-Express: The most easy way would be to get an existing project, and modify the CSPROJ-file (with notepad or any other ascii-editor)) like you can see it >>>here<<<. And then clear the code and input yours

 

>> That is the reason for Autocad library is unusable with Visual Express (you can´t produce dll) or?

Yes, you can, but a few steps has to be done to get project files prepared.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 16 of 16

DRossger
Advocate
Advocate

Yes I get it. Now I have maked a dll Man Tongue thanks Alfred 

PS.: it´s much complicate as I think before

0 Likes