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

0 Members and 1 Guest are viewing this topic.

sinc

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #15 on: April 21, 2007, 12:41:02 AM »
It works fine for me.  Everything seems to run fine, and I haven't seen any eDuplicateKey errors.  Seemed pretty painless.   :?

Are you trying to use 2008?  Ours hasn't arrived yet, so we're still on 2007.

sinc

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #16 on: April 21, 2007, 12:45:48 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.

I haven't done much yet with VS C#, but I think I like it better so far.  For the most part, it's pretty similar.  I had SharpDevelop 2.0 crash on me, but so far I haven't had any issues with 2.1.  However, I think I like the code highlighting in VS better.  SharpDevelop highlights all method calls, regardless of where they are defined.  VS highlights items (type definitions in addition to methods) loaded from frameworks, making them stand out from items defined in the local code, which is more-useful.  And with SharpDevelop, I had to go into the Options and switch the active help between the ObjectARX and the .NET framework all the time, which was annoying.  In VS, both help collections are active at the same time.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: MS Visual Studio C# or SharpDevelop?
« Reply #17 on: April 21, 2007, 02:53:51 PM »
I'm glad you like it, Sinc. I'm also completely befuddled.....

I zipped up my version of SincPac, placed your VS version in my projects folder, compiled, and it works just fine, as you said. So I went back and did a side by side comparison, with the exception of 2 references I didn't need I couldn't find any major differences that would make yours work but not mine.
* Jeff_M ***<throws hands in air>***
I give up. I spent about 5 hours over the past few days chasing this error, no more. Did I metion I'm glad you switched to VS C#? :-D

So here's the whole reason I was trying this in the first place.....I just wanted to add the lisp routine I wrote last year to rotate points. Someone had posted that it was giving them the dreaded "unwind skipped on unkown exception" error. So I thought if it was written in C# I might eliminate that problem, and it would probably run quicker, too. By using your tools I figured it would cut down on the development time AND it could be added to your package, as you did ask for code contributions.

I do have both 2007 & 2008 installed and was starting to think my problem was related to that. But since yours works just fine, I've eliminated that possibility. So I've now just deleted my feeble attempts to convert your code and will just use what you posted. Thanks again!

Oh, one other reason I prefer VS C# is because I could never figure out how to run in Debug mode in SD. In VS C# it's pretty simple to setup debugging, and I learned from Kerry about using a script that opens a specific test drawing and loads the DLL.

Here's my contribution:
Code: [Select]
/*
 * User: Jeff Mishler
 * Date: 4/16/2007
 * Time: 7:24 AM
 *
 */

using System;
using Autodesk.AECC.Interop.Land;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Interop;
using Autodesk.AutoCAD.Runtime;
using Civil3DUtilities;

namespace SincPac.RotatePoints
{
/// <summary>
/// Description of RotatePoints.  Code to set the rotation
    /// angle of C3D points. Written to be a part of Edward-James Surveying's
    /// excellent SincPac C3D routines.
    ///
    ///  To Do: determine what the current rotation value is, as defined
    ///  by the Point Marker Style, and calculate the desired angle factoring in
    ///  the style's angle. Right now it just sets the point's rotation angle to the
    ///  input value, but it may not display as desired due to the style's, both the
    ///  point and point group, angle being applied.
/// </summary>
    public class RotatePoints
    {
        public RotatePoints()
        {
        }
        public double rotpts_angle;

        [CommandMethod("ROTPTS")]
        public void RotatePointsCommand()
        {
            try
            {
                C3DUtil c3dUtil = new C3DUtil();
                Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
                AeccPoints aeccpoints = c3dUtil.AeccDb.Points;
                PromptAngleOptions prmpt = new PromptAngleOptions ("\nAngle to rotate points to:");
                prmpt.DefaultValue = rotpts_angle;
                prmpt.AllowArbitraryInput = false;
                prmpt.UseDefaultValue = true;
                PromptDoubleResult pres;
                pres = ed.GetAngle(prmpt);
                ed.WriteMessage("\nSelect points to rotate:");
                int[] ptNumList = (int[])c3dUtil.AeccDoc.SelectPoints();
                foreach (int PointNum in ptNumList)
                {
                    AeccPoint aeccpt = aeccpoints.Find(PointNum);
                    aeccpt.Rotation = pres.Value;
                }
                rotpts_angle = pres.Value;
                if (ptNumList.GetUpperBound(0) == 0)
                {
                    ed.WriteMessage("\nRotated 1 point. ");
                }
                else
                {
                    ed.WriteMessage("\nRotated {0} points. ", ptNumList.GetUpperBound(0) + 1);
                }
            }
            catch
            {
            }
        }
    }

}

sinc

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #18 on: April 21, 2007, 06:16:41 PM »
So here's the whole reason I was trying this in the first place.....I just wanted to add the lisp routine I wrote last year to rotate points. Someone had posted that it was giving them the dreaded "unwind skipped on unkown exception" error. So I thought if it was written in C# I might eliminate that problem, and it would probably run quicker, too. By using your tools I figured it would cut down on the development time AND it could be added to your package, as you did ask for code contributions.

Great!  I'll add it to the pack.

Quote
Oh, one other reason I prefer VS C# is because I could never figure out how to run in Debug mode in SD. In VS C# it's pretty simple to setup debugging, and I learned from Kerry about using a script that opens a specific test drawing and loads the DLL.

I was just struggling with that.  Unlike you, I had absolutely no trouble getting debuggin working in SD - it just flat-out worked.  All I had to do was point the project to the acad.exe file (since I was creating class libraries, not complete applications), and configure the ACAD.LSP file to load the debug version of the DLL at startup.  Everything else was automatic.  I could just hit "run" from within SD, and it would startup C3D for me.

In VS, I still haven't gotten debugging working.  What's the script?  What language?  How do you create and run it?

I had found something in the VS help about adding a "test project", which could then be set to compile in debug mode, but haven't yet parsed out exactly what that means.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: MS Visual Studio C# or SharpDevelop?
« Reply #19 on: April 21, 2007, 06:30:44 PM »
Well, I admit I didn't spend too much time trying to get the Debug to work in SD...no wonder it didn't.  :roll:

To get to work in VS C#, with the subject project closed.... in your project folder that holds the *.csproj file edit the *.csproj.user file. This is what mine looks like for my new SincPacC3D-2008 project:
Code: [Select]
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <StartAction>Program</StartAction>
    <StartProgram>C:\Program Files\AutoCAD Civil 3D 2008\acad.exe</StartProgram>
    <StartWorkingDirectory>q:\</StartWorkingDirectory>
    <StartArguments>/b "C:\Base Maps\Jeffs Test Files\Test C#\sincpac-2008.scr"</StartArguments>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <StartAction>Program</StartAction>
    <StartProgram>C:\Program Files\AutoCAD Civil 3D 2008\acad.exe</StartProgram>
    <StartWorkingDirectory>q:\</StartWorkingDirectory>
    <StartArguments>/b "C:\Base Maps\Jeffs Test Files\Test C#\sincpac-2008.scr"</StartArguments>
  </PropertyGroup>
   <PropertyGroup>
    <ProjectView>ProjectFiles</ProjectView>
  </PropertyGroup>
</Project>
Then my sincpac-2008.scr is just an Acad Script that opens a dwg and netloads the dll
Code: [Select]
open
q:\points-3
netload
"C:\Documents and Settings\Master\My Documents\Visual Studio 2005\Projects\SincPacC3D-2008\SincPacC3D\bin\Debug\SincPacC3D-2008.dll"


HTH

I should add that I got the above to work thanks to posts by Kerry Brown and Paul Richardson in THIS thread.
« Last Edit: April 21, 2007, 06:36:37 PM by Jeff_M »

sinc

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #20 on: April 21, 2007, 08:03:39 PM »
Thanks.  I got it working now.

That's one up for SD... It was significantly simpler there, and took me all of a few minutes to get working.  It's basically the same thing, except it's possible to configure the builds from the project settings inside of SD, rather than by hand-creating a text file.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: MS Visual Studio C# or SharpDevelop?
« Reply #21 on: April 21, 2007, 08:09:18 PM »
From the screen shots that Kerry has posted recently, I think the full version, i.e. non-Express, of VS works the same way as SD. This is just one of the crippled areas they placed in Express.

sinc

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #22 on: April 21, 2007, 08:58:01 PM »

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


Seems to be caused by having an asterisk for the build/revision in the AssemblyFileVersion line in the AssemblyInfo.cs file.

Removing the declaration for AssemblyFileVersion fixes the problem.  As far as I can tell, this is OK, and causes the AssemblyFileVersion to be the same as the AssemblyVersion.

sinc

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #23 on: May 20, 2007, 09:35:24 AM »
After using MS VS Express for a while, I like the Intellisense a little better - SharpDevelop does not automatically highlight elements defined in other classes the way VS Express does, and all-in-all, I find the VS Express intellisense a bit more useful.  And I like the Help in VS Express significantly better, because I can see the .NET SDK help and the ObjectARX help simultaneously.  In SharpDevelop, I had to constantly go into the Options and switch the active help file between the two, which got old really fast.

As I mentioned a few posts back, the debugging is fully built-in to SharpDevelop, making it much easier in there.  Sure, it's possible to get debugging working in VS Express by hand-creating the .csproj.user file, but that isn't explained in the Help, and it's not intuitive at all.  Very user-unfriendly, but I got it working.

Unfortunately, there are several other items that were also very simple in SharpDevelop, but not in VS Express.  I've still been unable to find any way to do the following tasks:

  • Clean the project.  SharpDevelop had the "Build Clean" option that I've seen in every IDE I've ever used, but I've been unable to find this feature in VS Express.  I've discovered I can use Windows Explorer to go into the "obj" directory of my project and delete all the build files, and this basically does a "build clean", but it's very annoying needing to use Windows Explorer for this.  Is there a "Build Clean" option hidden in here anywhere?
  • Reformat text.  With SharpDevelop, I could hit CTRL+I at any time, and it would reformat my text.  I've been able to get VS Express to do the same thing whenever I type a closing brace, but that's the only way I've been able to do it.  So when I want to force a reformat of my code, I've been going to the closing brace of the method, then deleting it and retyping it.  This works, but it's a lot more annoying than simply being able to hit CTRL+I from any point in the code.  Is there an equivalent to SharpDevelop's CTRL+I command in VS Express?
  • Purge unneeded "Using" statements.  SharpDevelop has a handy feature that removes all the unused "Using" statements from a code file.  That meant I could create a class template that has a complete list of "Using" statements in it, including ALL of the namespaces that I generally use.  Then after writing the code in the class, I could simply run "Remove unused import statements" and get rid of all the unnecessary "Using" statements.  Is this feature in VS Express?
  • Build Debug.  In SharpDevelop, I can set either my Release build or Debug build as the "current" one, then I can build either version by hitting the "Build" button.  In VS Express, I have not been able to find any way to build the Debug version without running the debugger.  This launches Civil-3D, because that's the way I have the debugger configured.  But is there any way to simply build the Debug version without launching Civil-3D, and without changing the debug configuration?  I almost-always want to launch C3D when building the Debug version, but occasionally I just want to rebuild it without launching Civil-3D.  Is this possible without changing my .csproj.user file?

Chuck Gabriel

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #24 on: May 20, 2007, 11:48:27 AM »
I know there are equivalents to a couple of the things you mentioned.

To reformat the current document, type Ctrl+E,D.  More generally, look on the Edit pulldown under Advanced.

Under Tools->Options->Projects and Solutions->General, there is an options to "show advanced build configurations."  It will add a couple of listviews to the standard toolbar where you can select build options.

I don't know about the rest.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8698
  • AKA Daniel
Re: MS Visual Studio C# or SharpDevelop?
« Reply #25 on: May 20, 2007, 12:13:01 PM »
1, Chuck got this one

2, It is not necessary to “purge” the using statements. The compiler will do this for you.
I agree it does tidy up the source, but you don’t have to worry about code bloat.
http://blogs.msdn.com/csharpfaq/archive/2004/10/20/245411.aspx

3, CTRL+E,D will format the document, CTRL+E,F will format the selection

4, under the project properties->Debug, you should have a start action radio button that you can deselect.

sinc

  • Guest
Re: MS Visual Studio C# or SharpDevelop?
« Reply #26 on: May 20, 2007, 01:24:24 PM »
Under Tools->Options->Projects and Solutions->General, there is an options to "show advanced build configurations."  It will add a couple of listviews to the standard toolbar where you can select build options.

AH!  After you told me where to look and I still couldn't find it, I finally noticed that little "Show all settings" checkbox in the bottom-left corner of the Options dialog.  When I checked that, a WHOLE BUNCH of things I had been looking for suddenly appeared!  I understand the desire to clean up the UI, but I don't think I really like these obscure controls that hide useful functions.  Oh well, got things turned on now.

I still don't see a "Build Clean" option...  Is that hidden in there somewhere?

It seems like I tried the CTRL+E,D thing and it didn't work for some reason, but it's working now.  Maybe I had something wrong in my code when I tried it before.

As for purging the unneeded Using statements, I *do* like to do that, because I think it makes it makes things a little clearer, particularly for newbies who are not yet familiar with the API and are trying to parse the code.  It's not a big deal, though.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8698
  • AKA Daniel
Re: MS Visual Studio C# or SharpDevelop?
« Reply #27 on: May 20, 2007, 01:50:42 PM »
If you right click on the project in the solution explorer, you see a clean and rebuild option? 

Bryco

  • Water Moccasin
  • Posts: 1883
Re: MS Visual Studio C# or SharpDevelop?
« Reply #28 on: May 20, 2007, 03:43:14 PM »
I have that on the professional  but not on the express.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: MS Visual Studio C# or SharpDevelop?
« Reply #29 on: May 20, 2007, 05:02:14 PM »
It's a while since I've used Express, but there IS a Rebuild Option either Rt Click on the Solution or from the Build Menu.
... Clean { remove ALL unneeded files} is not available in express.

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.