Author Topic: MS Visual Studio C# or SharpDevelop?  (Read 16535 times)

0 Members and 1 Guest are viewing this topic.

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
MS Visual Studio C# or SharpDevelop?
« on: April 17, 2007, 07:37:42 PM »
I've been (ab)using, er learning, MSVS for some time and have grown accustomed to the display. Wanting to add a few commands to Sinc's quite useful Civil3D commands I tried to place his Project into my VS Projects folder. HA! I get lots of warnings on opening, namely "The file 'AutocadUtilities\C3DUtil.cs' could not be added to the project.  Cannot add a link to the file C:\Documents and Settings\Master\My Documents\Visual Studio 2005\Projects\Sincpac\Sincpac\AutocadUtilities\C3DUtil.cs. This file is within the project directory tree." etc. Being about as bright as a brick in this VS stuff I cannot figure out how to edit Sinc's code in VS.

OK, no problem, I'll just download and install SharpDevelop! Great, everything goes as planned, unzip the project to the SD Projects folder and AH HA! I can open and edit without any problems. Except.......the interface is a bit different, the (excuse my ignorance in the correct terminology) known types are not highlighted, the code dosen't seem to want to auto format itself, and some other things I'm not recalling right now. Oh, and I got 2 Fatal Errors while just looking around at Sinc's code and 1 more when attempting to build it.  So I'm finding it is giving me headaches looking at the code in SD.

So, can anyone give me step by step instructions on How-To either use this code in VS2005 OR get SD to appear similar to VS2005?

Thanks!
Jeff "the brick"

LE

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #1 on: April 17, 2007, 07:56:30 PM »
Jeff;

Is Sinc's a SLN or just the class file for a C# project?

I use VS2005

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: MS Visual Studio C# or SharpDevelop?
« Reply #2 on: April 17, 2007, 08:06:57 PM »
The easiest way would be to create a class library project, copy the source files and paste them into the new project folder and add them to the project (removing any existing project files if needed) and 'ref' in any lib's you need to link against and you should be right to go.
This applies to both ide's.

The import feature is nice but there is work arounds.
hth
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: MS Visual Studio C# or SharpDevelop?
« Reply #3 on: April 17, 2007, 08:13:22 PM »
There's a SLN. The complete source code can be found near the bottom of THIS page.

I'm about to head for a dinner engagement but I'll be back later tonight. So if you don't hear from me for a while it's not because I'm ignoring anyone. :-)

Oops, Mick snuck in there. Thanks, I was hoping to be able to avoid that as he has quite a number of CS files and forms. But if I must.....

LE

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #4 on: April 17, 2007, 08:30:38 PM »
To bad I do not use C3D, but you can remove those References and do the manual reference again... that's what I do/did for example with acdbmgd.dll and acmgd.dll, then do it with the other ones showing the little yellow error icon on the solution explorer tree

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: MS Visual Studio C# or SharpDevelop?
« Reply #5 on: April 18, 2007, 01:21:41 AM »
Hi Luis, thanks. Yes, I can set the references OK. But see the AutocadUtilities folder is empty? It should have 3 classes in it. These 3 are all listed under the Errors & Warnings as not being able to be referenced due to being withing the project folder. These, and others like them, are what I'm having trouble with.

I just downloaded the VC#Express to work on this on my wife's PC (no Autocad or Civil3D). I have tried importing Existing objects, new Import for each Folder in the project. I'm still getting other errors. But now my head is swimming with other issues I've thought of. Must take a break and restart this in the morning with some fresh eyeballs.

Thanks for the tips guys.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: MS Visual Studio C# or SharpDevelop?
« Reply #6 on: April 18, 2007, 01:40:17 AM »
..................
I just downloaded the VC#Express to work on this on my wife's PC (no Autocad or Civil3D). I have tried importing Existing objects, new Import for each Folder in the project. I'm still getting other errors. .............

Without the installed DLL's from AC or C3D you will get a 'missing stuff' < technical term>  error.

I was going to have a try but stopped when I saw the C3D references.

You may get differing opinions on this, but I believe you'd be happier if you can get the VS2005 to load it.

Good fortune with it Jeff !
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: MS Visual Studio C# or SharpDevelop?
« Reply #7 on: April 18, 2007, 12:27:28 PM »
OK, I got it working, thanks Mick's suggestion. Of course it took me a while to realize that the folders I copied couldn't be seen in the VS2005 IDE until I clicked the little button "show all files". There were still a few errors that crept in, namely I had to remove from each of the subfolders any AssemblyInfo.cs .

Kerry, on my wife's computer, other than the missing references (which I knew I'd get), the exact same errors/warnings were given about not being able to add certain/many of the classes in the sub-folders as I was getting on my work pc.

The good news is, It's working in VS2005..... the bad news is, The first thing I want to add is making me learn more than I have time for...... oh well. Thanks for the help, guys!

sinc

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #8 on: April 19, 2007, 09:18:36 PM »
Are you using the full version of VS2005, or the Express?

I've been wondering how SharpDevelop compares with VS Express.  SharpDevelop works better than the VS that I remember, but I haven't used VS since I was doing lots of C++ programming in the late 90's, so that isn't a fair comparison.  SharpDevelop is pretty nice, but I'd switch to VS Express if there's a good reason.

TR

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #9 on: April 19, 2007, 09:24:03 PM »
http://community.sharpdevelop.net/blogs/mattward/articles/VisualStudioExpressComparison.aspx

Note it says no help docs for SharpDevelop which isn't entirely true. Instead of local docs it uses MSDN which works quite well.

sinc

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #10 on: April 19, 2007, 09:29:05 PM »
Hmmm...  I don't really see anything in that table that makes me want to jump over...

Anyone have experience with both and prefer one over the other for any strong reason?

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: MS Visual Studio C# or SharpDevelop?
« Reply #11 on: April 20, 2007, 12:43:58 PM »
Hi Sinc,
Although my experience with SharpDevelop is minimal and with VS C# Express only somewhat more than that, I can say that I prefer the MS version by far. I think the IDE is cleaner, integrated help is nice, it seems like the Intellisense works better, I haven't had it crash even once, and since there is more code posted written in VS than SD it "just works" when opening/importing it in my own project.

Your SincPac3d code I finally was able to get into VS without errors. It compiled without errors, but attempting to load it in C3D2007 gives me a number of lines describing an error so it won't load. The one that starts it is "eDuplicateKey". I've searched high & low for the meaning of this but have has zero hits. I thought it may be the GUID, so I removed the reference to that but the same error persists.

It would be nice if the 2 IDE's put out code that the other could open without jumping through hoops. I haven't tried taking A VS project and opening with SD, but I'll bet it's a similar runaround.

sinc

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #12 on: April 20, 2007, 10:35:58 PM »
OK, I downloaded the VS Express for C#.

I didn't just try to open the project in VS Express (although maybe I should have), because of the issues you've been having.  Instead, I created a new project in VS Express, then added the files using the "Add existing item..." option.  Everything seems to be working fine.  This post has a zip file of the VS project attached.  Since there are more people using VS Express than SharpDevelop, I'll probably post the VS version the next time I update our website.

The extra AssemblyInfo.cs files were from the early version, where I had a bunch of "subprojects".  This caused the project to compile into a bunch of seperate DLLs.  I decided I prefered a single DLL, and reorganized the project, but the extra AssemblyInfo.cs files were left behind.

The only thing I notice is that the Build and Revision numbers are not showing up in the compiled DLL.  It's showing up as version "0.6.0.0".  In SharpDevelop, that asterisk in "0.6.*" in the AssemblyInfo.cs was automatically converted to Build and Revision numbers, so I would get something like "0.6.2760.17502", but that's not happening in VS.
« Last Edit: April 20, 2007, 10:37:52 PM by sinc »

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: MS Visual Studio C# or SharpDevelop?
« Reply #13 on: April 20, 2007, 11:25:15 PM »
Thanks, Sinc. I've done the same as you've described. Have you tried loading the dll in C3D?

I hadn't noticed the Build/Revision issue. If I ever get it working I'll look into that. :-)

Here's what I get when loading the DLL:
Quote from: Failed Command Line
Cannot load assembly. Error details: Autodesk.AutoCAD.Runtime.Exception: eDuplicateKey
   at Autodesk.AutoCAD.Runtime.Interop.Check(Int32 returnValue)
   at AcMgCommandClass.AddCommand(AcMgCommandClass* , ICommandLineCallable ca, MethodInfo mi)
   at Autodesk.AutoCAD.ApplicationServices.AutoCADApplicationHolder.Initialize(Assembly assembly)
   at Autodesk.AutoCAD.ApplicationServices.ExtensionLoader.ProcessAssembly(Assembly assembly)
I have been unable to determine what that eDuplicateKey refers to.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: MS Visual Studio C# or SharpDevelop?
« Reply #14 on: April 20, 2007, 11:34:04 PM »
Is there a disparity in versions .. or an Object Enabler issue ??

does sinc's solution include copies of some of the ACAD dll's ?
« Last Edit: April 20, 2007, 11:35:43 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.