PDA

View Full Version : If I wanted to start coding in .NET....



Coolmo
2009-03-11, 12:24 PM
What version of Visual Studio should I get? We're running Civil3D 2007 over here and I was wondering if the version of Visual Studio matters as far as compatability and moving forward (or even backwards) when it comes to developing programs for AutoCAD. My next question really makes me seem new to all of this but...

Is there a free Visual Studio editor like the VBA editor packaged with AutoCAD now? If not inside of AutoCAD how about a free one that obviously runs outside of AutoCAD? I'm use to writing VBA (DVB files) from AutoCAD with it's built-in editor and I'm trying to justify to myself if it's worth paying into an editor just to learn on. I downloaded and watched a 2.5 hour video last night, "DevTV - Introduction to AutoCAD. NET Programming" and it really got me hooked on what .NET API can do. Now I'm very anxious. Advice?

Jeff_M
2009-03-11, 01:33 PM
Heh, I just posted the info you need in the thread you asked this in the VBA group.....

http://www.microsoft.com/Express/

It's the free version of VS.

Ed Jobe
2009-03-11, 08:48 PM
If you develop for 2009 and prior, you need vs 2005. 2010 will require vs2008.

ethomson
2009-03-12, 12:39 PM
If you develop for 2009 and prior, you need vs 2005. 2010 will require vs2008.

That's only true if you are doing ObjectARX development with C++.

For DotNet that's not true at all. You can use the Visual Studio Express editions C# or VB.NET just fine

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=8007696

Ed Jobe
2009-03-12, 02:19 PM
That's only true if you are doing ObjectARX development with C++.

For DotNet that's not true at all. You can use the Visual Studio Express editions C# or VB.NET just fine

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=8007696
Are you talking about VS full vs Express or 2005 vs 2008? The link you provided doesn't say anything about which version of vs is required.

ethomson
2009-03-12, 02:23 PM
Are you talking about VS full vs Express or 2005 vs 2008? The link you provided doesn't say anything about which version of vs is required.

This is the applicable part of that link

"AutoCAD Civil 3D provides .NET Interop assemblies that expose the ActiveX interfaces so that they can be programmed using .NET technologies, such as VB.NET, managed C++, and C#. .NET assemblies are also available for creating custom subassemblies.

Although AutoCAD Civil 3D does not expose an ObjectARX API, applications built with the AutoCAD ObjectARX SDK or the AutoCAD Map ObjectARX SDK will run within AutoCAD Civil 3D."

also this

"Extensive application development documentation for the ActiveX (COM Automation) API is built into the AutoCAD Civil 3D Help system. The Help system also contains information on C++ and .NET application development."

Ed Jobe
2009-03-12, 03:04 PM
My statement which you challenged related to binary compatiblity. The "applicable part" you quoted does not mention binary compatiblilty.

ethomson
2009-03-12, 03:16 PM
My statement which you challenged related to binary compatiblity. The "applicable part" you quoted does not mention binary compatiblilty.

Like I said before that only applies to ObjectARX not .Net Assemblies
http://through-the-interface.typepad.com/through_the_interface/2009/02/migrating-your-application-to-work-with-autocad-2010.html

That applies to vanilla Autocad

Civil3d doesn't have it's own ObjectARX or .net assemblies. It's only using the ActiveX interop assemblies. If that's changed with newer releases I don't know but for 2007 that's not the case. See an example here
http://through-the-interface.typepad.com/through_the_interface/civil_3d/

You can use whatever you want.

The only time that you are required to use a specific Visual Studio version is when you are developing C++ ObjectARX apps.

Ed Jobe
2009-03-12, 03:35 PM
I still think you are on a different page than me. My comment was about VS 2005 vs VS 2008. They are not binary compatible. Technically, Express is not a different "version", but a subset, a "flavor" if you will. For example, if you use VB.Net Express 2005 to compile a dll, it will be different from the same source code compiled with VB.Net Express 2008. Kean's column you cited, mentioned nothing of using 2005 or 2008. If you have a source that says other than my original statement, I'm all ears. The whole point of why I started this is that the source for acad 2010 is compiled with VS 2008. If you use VS 2005 to compile a dll intended for use with acad 2010, it will not be binary compatible with the host the dll is running in.

ethomson
2009-03-12, 04:55 PM
I still think you are on a different page than me. My comment was about VS 2005 vs VS 2008. They are not binary compatible. Technically, Express is not a different "version", but a subset, a "flavor" if you will. For example, if you use VB.Net Express 2005 to compile a dll, it will be different from the same source code compiled with VB.Net Express 2008. Kean's column you cited, mentioned nothing of using 2005 or 2008. If you have a source that says other than my original statement, I'm all ears. The whole point of why I started this is that the source for acad 2010 is compiled with VS 2008. If you use VS 2005 to compile a dll intended for use with acad 2010, it will not be binary compatible with the host the dll is running in.

No I understand that the express editions are not different versions altogether.

When you are compling .net applications you are compiling against the .net framework that you select 2,3,3.5 etc. Since you are referencing type libraries it's generating an interop assembly that is simply access the ActiveX interface exposed by Autocad so it doesn't matter at all what version of 2005 standard/express/professional vs 2008 standard/express/pro etc.

Try it before you say it can't be done. Because while I don't use Civil3d I've compiled plenty of both native .net assemblies (dlls that are netloaded) & standalone apps for Vanillia autocad accessing the com/activex interface and can tell you that it doesn't matter what version (release or edition) you use.

Ed Jobe
2009-03-12, 05:28 PM
Now I see what you are saying. I went back and reread the source where I got my earlier info and I was wrong. Thanks.

BTW, I haven't noticed your name in the programming forums yet. Welcome and hang around.

dgorsman
2009-03-12, 11:06 PM
Now I see what you are saying. I went back and reread the source where I got my earlier info and I was wrong. Thanks.

BTW, I haven't noticed your name in the programming forums yet. Welcome and hang around.

For further clarification, I beleive the major caution when using VS 2008 for pre-2010 versions of AutoCAD is to watch the .NET framework being targetted. Earlier versions might not have .NET 3.0 or 3.5 installed.

jonesb33145
2009-03-29, 08:39 AM
To answer Coolmo...you should jump to .NET...it is so much better over here. Here are a couple of things that I love:


Being able to create actual commands. having to create a lisp routine just to run your command from the command line sucked...being able to have this stuff demand load is awesome.
Much more fruitful api - being able to do jigs? awesome.
Tons faster - Being able to set when stuff is added through transactions makes all the difference in the world.
OO Programming instead of macro progamming. To be able to enter a world where you can have classes and actually test the stuff your running thoroughly is awesome. As a ex vba'er I can't tell you how much this is helps.


I have used both 2008 and 2005 and I would say jump to 2008...no real reason except it is the latest.

Hope this helps.

Ben

Coolmo
2009-07-21, 03:41 PM
To answer Coolmo...

I have used both 2008 and 2005 and I would say jump to 2008...no real reason except it is the latest.

Hope this helps.

Ben

If I were to jump to 2008 express would it still run in Civil 3D 2007?

It appears from all the tech talk above that I can still run my .net applications compiled with 2005 express in later versions of AutoCAD. I have hundreds if not thousands of pages of code in VBA that I now have to put into .net and I personally don't want to have to do this all over again when something new comes along. It'll probably be a while before we start upgrading to the newer versions of AutoCAD but I want to be ready to go when we do.

dgorsman
2009-07-21, 06:53 PM
If I were to jump to 2008 express would it still run in Civil 3D 2007?

It appears from all the tech talk above that I can still run my .net applications compiled with 2005 express in later versions of AutoCAD. I have hundreds if not thousands of pages of code in VBA that I now have to put into .net and I personally don't want to have to do this all over again when something new comes along. It'll probably be a while before we start upgrading to the newer versions of AutoCAD but I want to be ready to go when we do.

Thats one of the downsides of .NET - having to rebuild when you upgrade to a newer version of AutoCAD. You know how professional packages say "Requires AutoCAD 2008/09/10" or similar? Same deal.

sinc
2009-07-31, 01:10 AM
You can use either VS 2005 or VS 2008 to compile .NET apps that will work in any version of Autocad. As was stated earlier, though, if you create an app that targets .NET 3.0 or 3.5, then that framework must be installed on the target machine. It was not installed as part of earlier Autocad installations, but most people have .NET 3.5 installed by now.

One thing to be aware of is that if you target .NET 3.5, you may have problems running your app unless the target machine has been updated with .NET 3.5 SP1. But as long as everyone is keeping up-to-date with Windows updates, that shouldn't be a problem.

If you create a .NET application and only use the managed API, you can compile an app once and you do not need to recompile it for later versions of Autocad. It's possible that at some future point, Autodesk will make a change that will cause your application to fail to work. But in general, if your .NET app works in Autocad 2007, it will also work in Autocad 2008, and 2009, and 2010...

The exception is if you use the Interop libraries from .NET (as is required for most access to Civil 3D). In that case, you must recomile your application specifically for each year. But even with Civil 3D, you can avoid using the Interops if you really want to, and create a single compiled DLL that will work in multiple versions of Civil 3D. It's a lot more work to do it that way, and you lose much compiler support, but it can be done.

Bobby C. Jones
2009-07-31, 08:06 PM
Thats one of the downsides of .NET - having to rebuild when you upgrade to a newer version of AutoCAD. You know how professional packages say "Requires AutoCAD 2008/09/10" or similar? Same deal.

That's only true for C++ ARX apps. I have a .NET app that runs in 2007-2010, one compile.

pjohnson.137155
2009-08-02, 09:26 PM
I was going to say, you do not have to recompile your code - been running apps from 2007 onward. One of the powers of OO if you ask me

Patrick K Johnson
http:\\www.cadenhancement.com

brett.burling
2009-08-31, 08:19 AM
What about different operating systems?
We have a mixture of XP, Vista and soon Windows 7 both 32bit and 64bit. Do I need to compile a different version for each one?

or is that taken care of by ensuring each system is running the latest version of the .net framework?

sinc
2009-08-31, 04:41 PM
To some extent, that depends on what your application does.

In theory, you should be able to simply run your code on any platform, without caring. But there are certain rules that are enforced by UAC in Vista and Win7, so some things that people used to do in XP are no longer allowed. You may also have path differences, but as long as you are using the correct parts of the .NET framework to get things like the user home directory, you should be OK. The 32-bit vs. 64-bit thing should be completely transparent, as long as you are staying in your .NET language, and are not doing things like P/Invoke calls and so forth.

I suppose the answer is "You should be able to create one compiled DLL, but you should test it on all platforms to make sure."