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

Newbie question - Managing, updating & loading .net dlls

10 REPLIES 10
Reply
Message 1 of 11
Anonymous
460 Views, 10 Replies

Newbie question - Managing, updating & loading .net dlls

Alright, so I'm slowly moving to .net from vba, I like it, specially the visual studio tools make it allot more friendly to write code.
I'm using Visual Studio Express VB edition (free one).

My questions are the following:

1. Once I have a dll, how do I share with people, do I need the other files in the bin\release folder? I noticed that if I were to just copy the dll to another location and do a netload, then it doesn't work. Do I need to publish the dll somehow?

2. What are general or best practices for managing the dlls for inhouse development? Keep all code in one dll? split by function? For example, in VBA I have 2 dvb files, 1 for batch processing functions and 1 for single file processing. Each has about 10-15 modules and 5-10 forms.
What is the best way to do this in .net?

Thanks for your help.

Viktor.
10 REPLIES 10
Message 2 of 11
Anonymous
in reply to: Anonymous

If your project references other assemblies (*.dll files) aside
from the AutoCAD interop assemblies (acmgd/acdbmgd.dll),
then you must include those referenced assemblies as well.

You should never include the AutoCAD assemblies (acmgd.dll
and acdbmgd.dll) because they are already in the AutoCAD
folder. You should also set their 'copy local' property to false
or you may have problems debugging.

As far as how to structure your code, that really depends on
specifics of its use and whether it is 'shared' code.

If for example you have code used in multiple, unrelated
projects (e.g., 'shared code'), it should be in a seperate
assembly that can be referenced by the project(s) that use it.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

wrote in message news:6000323@discussion.autodesk.com...
Alright, so I'm slowly moving to .net from vba, I like it, specially the visual studio tools make it allot more friendly to write code.
I'm using Visual Studio Express VB edition (free one).

My questions are the following:

1. Once I have a dll, how do I share with people, do I need the other files in the bin\release folder? I noticed that if I were to just copy the dll to another location and do a netload, then it doesn't work. Do I need to publish the dll somehow?

2. What are general or best practices for managing the dlls for inhouse development? Keep all code in one dll? split by function? For example, in VBA I have 2 dvb files, 1 for batch processing functions and 1 for single file processing. Each has about 10-15 modules and 5-10 forms.
What is the best way to do this in .net?

Thanks for your help.

Viktor.
Message 3 of 11
Anonymous
in reply to: Anonymous

Thanks Tony, for some reason I figured you'd be the first to help.

Well for the sake of testing this I've created a brand new project, added references to the 2 *mgd.dll's, and created a simple "hello world" command, added a windows form without any controls on it, and in my command said:

Dim form1 As Form1 = New Form1()
Application.ShowModalDialog(Form1)

Running the debug this works fine, but I'm lost on the "how do i take it from debug to production" steps.
In Visual Studio Express, i do have an option to build my project, so that builds a dll with some other files in the release folder, what do I do with that then? Should I be able to just copy and paste it to a shared location then? Cause this part does not work.

Do I need those supporting files, like the xml file and pdp file to be copied along?

I appreciate your help Tony.
Message 4 of 11
Anonymous
in reply to: Anonymous

You should only need your project's DLL.

Your questions are related more to the basic use of Visual Studio to build and deploy projects.

There's nothing special about building or deploying a project for use with AutoCAD, aside from the 'copy local' properties on the AutoCAD assembly references that I mentioned earlier.

Because of that, I would recommend you visit the Microsoft newsgroups for general Visual Studio build/deployment questions.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

wrote in message news:6000424@discussion.autodesk.com...
Thanks Tony, for some reason I figured you'd be the first to help.

Well for the sake of testing this I've created a brand new project, added references to the 2 *mgd.dll's, and created a simple "hello world" command, added a windows form without any controls on it, and in my command said:

Dim form1 As Form1 = New Form1()
Application.ShowModalDialog(Form1)

Running the debug this works fine, but I'm lost on the "how do i take it from debug to production" steps.
In Visual Studio Express, i do have an option to build my project, so that builds a dll with some other files in the release folder, what do I do with that then? Should I be able to just copy and paste it to a shared location then? Cause this part does not work.

Do I need those supporting files, like the xml file and pdp file to be copied along?

I appreciate your help Tony.
Message 5 of 11
Anonymous
in reply to: Anonymous

Thanks for advice Tony, I'll have to visit msdn site too, but I've had success building a few standalone programs in .net, I'm getting more and more familiar with OOP but I'm just not sure why this simple test is not working. I'm using the "AutoCad Managed VB Application" template to start my project, so the references are set to not copy from the getgo.

Hmmm, I must be missing something simple. Cause I was under impression, like you point out, that I should be able to just grab the dll out of the release folder and it should work.

Thanks again Tony.
Message 6 of 11
Anonymous
in reply to: Anonymous

Actually, let me add this:

If I don't use modal forms then I don't get this error and I'm able to just use the projects dll's. But as soon as I add a modal form then it crashes. I'm targeing .net framework that is definitely on the machine, referencing system.windows.forms dll, and it runs during debug but crashes when using it outside of debug.
Message 7 of 11
Anonymous
in reply to: Anonymous

Sorry, "it crashes" isn't telling us very much.

I can't play guessing games and that's essentially what
this is, in the absence of any kind of details about the
error, and/or your code.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm

wrote in message news:6000496@discussion.autodesk.com...
Actually, let me add this:

If I don't use modal forms then I don't get this error and I'm able to just use the projects dll's. But as soon as I add a modal form then it crashes. I'm targeing .net framework that is definitely on the machine, referencing system.windows.forms dll, and it runs during debug but crashes when using it outside of debug.
Message 8 of 11
Anonymous
in reply to: Anonymous

my apology, i've been on different threads researching this and forgot that I haven't even described the problem yet.

I get this error whenever a modal form is about to load. So in my code, which for the testing purpose is very very simple, works right up until the form is about to be loaded. Then I get this "unhandled exception error" and the details are:

Application does not support just-in-time (JIT)
debugging. See the end of this message for details.

************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Drawing.Icon.FromHandle(IntPtr handle)
at Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(IWin32Window owner, Form formToShow, Boolean persistSizeAndPosition)
at Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(Form formToShow)
at VbMgd1.ModalForm.ShowModalForm()
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.SecurityPermission
The first permission that failed was:

version="1"
Flags="UnmanagedCode"/>

The demand was for:

version="1"
Flags="UnmanagedCode"/>

The granted set of the failing assembly was:

version="1">

version="1"
Read="USERNAME"/>

version="1"
Unrestricted="true"/>

version="1"
Read="J:\Shared Data\AutoCad Support\LISP\"
PathDiscovery="J:\Shared Data\AutoCad Support\LISP\"/>

version="1"
Allowed="AssemblyIsolationByUser"
UserQuota="9223372036854775807"
Expiry="9223372036854775807"
Permanent="True"/>

version="1"
Flags="ReflectionEmit"/>

version="1"
Flags="Assertion, Execution, BindingRedirects"/>

version="1"
Unrestricted="true"/>

version="1"
Url="file:///J:/Shared Data/AutoCad Support/LISP/test5.dll"/>

version="1"
Zone="Intranet"/>

version="1"
Unrestricted="true"/>

version="1"
Level="DefaultPrinting"/>


The assembly or AppDomain that failed was:
test5, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The method that caused the failure was:
Void ShowModalForm()
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file:///J:/Shared Data/AutoCad Support/LISP/test5.dll
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at AcMgCommandClass.InvokeWorker(AcMgCommandClass* , MethodInfo mi, Object commandObject, Boolean bLispFunction)
at AcMgPerDocumentCommandClass.Invoke(AcMgPerDocumentCommandClass* , gcroot<:REFLECTION::METHODINFO>* mi, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.TargetInvocationSEHExceptionFilter.InvokeWorker()
at Autodesk.AutoCAD.Runtime.ExceptionFilter.Invoke()


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
acdbmgd
Assembly Version: 17.0.116.0
Win32 Version: 17.0.116.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcdbMgd.DLL
----------------------------------------
msvcm80
Assembly Version: 8.0.50727.1433
Win32 Version: 8.00.50727.1433
CodeBase: file:///C:/WINDOWS/WinSxS/x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1433_x-ww_5cf844d2/msvcm80.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
ResourceManagement
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/ResourceManagement.DLL
----------------------------------------
acmgd
Assembly Version: 17.0.116.0
Win32 Version: 17.0.116.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/acmgd.DLL
----------------------------------------
Redland.NET
Assembly Version: 1.0.2.1
Win32 Version: 1.0.2.1
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/Redland.NET.DLL
----------------------------------------
StyleUIStarter
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/StyleUIStarter.DLL
----------------------------------------
Autodesk.Spatial.Studio.UI
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/Autodesk.Spatial.Studio.UI.DLL
----------------------------------------
AcMapMdfModelMgd
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMapMdfModelMgd.DLL
----------------------------------------
AcDxUi
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcDxUi.DLL
----------------------------------------
AcDx
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcDx.DLL
----------------------------------------
AcDxUi.resources
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/en-US/AcDxUi.resources.DLL
----------------------------------------
AcMgdShared
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMgdShared.DLL
----------------------------------------
AcLayer
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcLayer.DLL
----------------------------------------
AcLayer.resources
Assembly Version: 17.0.54.0
Win32 Version: 17.0.54.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/en-US/AcLayer.resources.DLL
----------------------------------------
AcMapDataConnectUi
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMapDataConnectUi.DLL
----------------------------------------
AcMapDataConnectTools
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMapDataConnectTools.DLL
----------------------------------------
AcMapDataConnectPlugins
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMapDataConnectPlugins.DLL
----------------------------------------
Accessibility
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
AcMapDataGridUI
Assembly Version: 10.0.100.0
Win32 Version: 10.0.100.0
CodeBase: file:///C:/Program%20Files/Autodesk%20Map%203D%202007/AcMapDataGridUI.DLL
----------------------------------------
test5
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///J:/Shared%20Data/AutoCad%20Support/LISP/test5.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
TypeViewer
Assembly Version: 1.0.3140.32268
Win32 Version: 1.0.3140.32268
CodeBase: file:///C:/Documents%20and%20Settings/p13802/My%20Documents/TypeViewerSource/bin/Release/TypeViewer.dll
----------------------------------------

************** JIT Debugging **************
Application does not support Windows Forms just-in-time (JIT)
debugging. Contact the application author for more
information.

---------------------------------------------------------------------------
I have also tried one of sample projects from "through the interface" blog and get the same effect. So it is not my code.

If someone has a simple built dll that has a modal form and works for them, could they send it to me so I can test it if works on my machine?

Thanks,
Viktor.
Message 9 of 11
Anonymous
in reply to: Anonymous

Also if i were to use something like this:

dim frm1 as new form1
frm1.showdialog

then this works. But that's not the right way it seems, I don't have autocad symbol top left of the form but a generic .net symbol, which tells me that it launches outside of autocad not within autocad, not a good practice right?
Message 10 of 11
Anonymous
in reply to: Anonymous

Your code is failing because your DLL is not on the local system.

What you need to do is familiarize yourself with .NET and deployment.

By default, an assembly will not run across a local intranet, unless you have configured it using the .NET configuration tools.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm
Message 11 of 11
Anonymous
in reply to: Anonymous

Bingo, I made this post admitting that I don't know much about .net deployment/management of dlls and such.

Tony, what book would you recommend? or a class for a newbie like myself?

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