.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VB.NET: "A project with an Output Type of Class Library cannot be started directly"

16 REPLIES 16
Reply
Message 1 of 17
Anonymous
3262 Views, 16 Replies

VB.NET: "A project with an Output Type of Class Library cannot be started directly"

Hey there.

I'm *very green* in using VS2005.
With no former .NET experience.

I am pretty savvy in VBA for AutoCAD/ADT, however;
and am trying to convert some VBA code over to VB.NET.

Anyway,

How do I debug a *.dll for ADT?

I've tried to search past threads here,
but I *think* many of the older solutions for 2003/2004/2005 and
earlier versions of Visual Studio and .NET Runtime are no longer applicable?

What I've done so far:
1. added the location of my AutoCAD/ADT executable to the:
Project>Properties>Debug>Start Options>WorkingDirectory
2. Changed my references properties for:
acmdg.dll
acdbmgd.dll
AecArchMgd.dll
AecBaseMgd.dll
to 'Copy Local' = False

From what I can tell from past threads,
I *think* that I need to create somesortof "Startup Object" in
Project>Properties>Application?
(which is now set to "(None)")

Would someone be kind enough to outline the steps/settings required to allow
me to step through my code?
16 REPLIES 16
Message 2 of 17
RonnieWilkins
in reply to: Anonymous

1. Select Project > {YourProjectName} Properties.
2. Select the Debug tab.
3. Set 'Start Action' to 'Start external program: {Path to ADT's acad.exe}'.
4. Select Debug > Start Debugging.
5. After ADT finishes loading, type NETLOAD at the command prompt and browse to the 'VB.NET Project Location\bin\Debug' folder and select the dll for your project.

Make sure to turn off Loader Lock by selecting 'Debug > Exceptions...', expand Managed Debugging Assistants, and finally uncheck Loader Lock.
Ronnie Wilkins, Jr.
Message 3 of 17
Anonymous
in reply to: Anonymous

rwilkins wrote:
> 1. Select Project > {YourProjectName} Properties.
> 2. Select the Debug tab.

ok, so far..

> 3. Set 'Start Action' to 'Start external program: {Path to ADT's
> acad.exe}'.

I don't have this choice.
only:
Debug>Start Options>Command Line arguments:
Debug>Start Options>Working Directory:
Debug>Start Options>Enable the Visual Studio hosting process

those are all of my settings available under the Debug tab in Project
Properties.

Are you *sure* your instruction is compatible with Visual Basic 2005
Experess Edition?

> 4. Select Debug > Start Debugging.
> 5. After ADT finishes loading, type NETLOAD at the command prompt and
> browse to the 'VB.NET Project Location\bin\Debug' folder and select
> the dll for your project.
>
> Make sure to turn off Loader Lock by selecting 'Debug >
> Exceptions...', expand Managed Debugging Assistants, and finally
> uncheck Loader Lock.

Obviously, the rest of your steps are not applicable either...
Message 4 of 17
ChrisArps
in reply to: Anonymous

A really cool feature of dotnet is you do not even need an ide to write and debug code.
I use VS2005 pro and have no way to test this with the express editions, but it SHOULD work (famous last words).

Assuming a name of "myproject" for the dll project.

1) Shut down visual studio

2) Edit the xml file myproject.csproj.user for C# or myproject.vbproj.user for vb.net.
Make sure the "Start*" nodes are all present and fill them in, here is an example for ADT2007 running as plain AutoCAD.
You will have to change the arguments to match the desktop icon for ADT proper.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2004">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<StartAction>Program</StartAction>
<StartProgram>C:\Program Files\Autodesk Architectural Desktop 2007\acad.exe</StartProgram>
<StartArguments>/p "AutoCAD"</StartArguments>
<StartWorkingDirectory>C:\Program Files\Autodesk Architectural Desktop 2007\UserDataCache</StartWorkingDirectory>
</PropertyGroup>
</Project>

You should now be able to restart VS and hit F5 to debug.

Chris Arps
www.visionrez.com
Message 5 of 17
Paul Richardson
in reply to: Anonymous

Works fine in C# Express
Message 6 of 17
Anonymous
in reply to: Anonymous

CArps wrote:
> Make sure the "Start*" nodes are all present and fill them in,

Chris,

Thank you so much for helping...

here's my xml:



C:\Program Files\Autodesk Building Systems
2007\



C:\Program Files\Autodesk Building Systems
2007\


It doesn't loook *quite* like your example?What would be the
syntax for adding the 'start nodes'?Can you help further?
Message 7 of 17
ChrisArps
in reply to: Anonymous

You will have to attach the xml file or replace "<" with &amplt; and ">" with &ampgt; for me to see it here.

Chris Arps
Message 8 of 17
Anonymous
in reply to: Anonymous

CArps wrote:
> You will have to attach the xml file

ok, Chris.

Hereyago...

(remove the *.txt extension)
Message 9 of 17
ChrisArps
in reply to: Anonymous

I have edited the file and added the three nodes to the xml.

However, the current StartArguments node is set for ADT as Autocad. I don't have ABS installed to get the proper values.

You will need to right click on your ABS icon and copy everything after ".exe" to the StartArguments node so ABS will run correctly.

<StartArguments>PLACE ABS ARGUMENTS HERE</StartArguments>
Message 10 of 17
Anonymous
in reply to: Anonymous

CArps wrote:
> I have edited the file and added the three nodes to the xml.

thank you so much, Chris!

I'll try and run the debig now...

I'll report back here either way...
Message 11 of 17
Anonymous
in reply to: Anonymous

Corey A. Layton wrote:
> CArps wrote:
>
>>I have edited the file and added the three nodes to the xml.
>
>
> thank you so much, Chris!
>
> I'll try and run the debig now...
>
> I'll report back here either way...

and *where* is this file stored? I can't find it on my system?

--
Brian Winterscheidt
LWPB Architecture
Oklahoma City, Oklahoma
Message 12 of 17
Anonymous
in reply to: Anonymous

The file is not created by the Express editions.
Either use the file Chris posted, write your
own or edit and use one the user files in
the Labs.

"Brian Winterscheidt" wrote in message
news:5195766@discussion.autodesk.com...
Corey A. Layton wrote:
> CArps wrote:
>
>>I have edited the file and added the three nodes to the xml.
>
>
> thank you so much, Chris!
>
> I'll try and run the debig now...
>
> I'll report back here either way...

and *where* is this file stored? I can't find it on my system?

--
Brian Winterscheidt
LWPB Architecture
Oklahoma City, Oklahoma
Message 13 of 17
Anonymous
in reply to: Anonymous

Brian Winterscheidt wrote:
> and *where* is this file stored? I can't find it on my system?

It's not created by default, it seems.

goto Project Properties,
and add a path to the 'working directory',
(debug tab)
and save the project.

Then the xml should be there....
Message 14 of 17
Anonymous
in reply to: Anonymous

Corey A. Layton wrote:
> I'll report back here either way...

works great!

thanks again...

one more question:
does the debugger *have* to start its own session of acad,
or can you debug in a current session?
Message 15 of 17
ChrisArps
in reply to: Anonymous

I am always happy to put one more nail in that VBA coffin.
Maybe it will also help Bill with some of that that wealth he is complaining about ;^)

Since there is no "attach to process" in the UI and I don't think that info is written into a solution file, you will have to startup acad.exe.

You might be able to get the express debugger to attach to a running process by throwing an exception with debug.assert.

Chris Arps
Message 16 of 17
Anonymous
in reply to: Anonymous

since we need to shut down AutoCAD to unload
the assembly, do you really need to attach to a
running process?

wrote in message news:5196100@discussion.autodesk.com...
I am always happy to put one more nail in that VBA coffin.
Maybe it will also help Bill with some of that that wealth he is complaining
about ;^)

Since there is no "attach to process" in the UI and I don't think that info
is written into a solution file, you will have to startup acad.exe.

You might be able to get the express debugger to attach to a running process
by throwing an exception with debug.assert.

Chris Arps
Message 17 of 17
ChrisArps
in reply to: Anonymous

I have rarely used attaching to process. I typically change code and hit f5.

At least in vb.net/C# 2005 you can edit and continue. That should eliminate a lot of restarting, especially when trying to figure out the api by trial and error.

Chris Arps

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost