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

Strong name

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

Strong name

I am a beginner to VB, so this may be a dumb question. I have no strong name
selection. I am trying to be able to run this from autolisp.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callcomcomp.asp
under "Create a Key Pair and Sign the Assembly" Step # 3. I have no Strong
name property page.
how do I get one? Is there another way?

Thnaks
Matthew
10 REPLIES 10
Message 2 of 11
thenrich
in reply to: Anonymous

What are you trying to call from LISP and why are you trying to put a COM wrapper around a .NET solution?
Message 3 of 11
Anonymous
in reply to: Anonymous

I am working with a pre net enabled release of AutoCAD. I am good with lisp,
just trying to make the transition slowly. or see how the two can work
together? I suppose I could purchase a downgrade to a previous version of
VB. I thought it would be easier to focus on the .net version rather than
try to figure out how to do it the old way as well.


Matthew


wrote in message news:4909930@discussion.autodesk.com...
What are you trying to call from LISP and why are you trying to put a COM
wrapper around a .NET solution?
Message 4 of 11
thenrich
in reply to: Anonymous

You can just compile your .NET app and call a shell. You don't need to convert it to a COM app to use it.
Message 5 of 11
Anonymous
in reply to: Anonymous

if you could also read the above post vla-object with no properties or
methods. Compiling that same class library would work if I used it from
VBA. It will not work from lisp.

How do I call a shell?

Thanks.
Matthew

wrote in message news:4910050@discussion.autodesk.com...
You can just compile your .NET app and call a shell. You don't need to
convert it to a COM app to use it.
Message 6 of 11
thenrich
in reply to: Anonymous

If you actaully want to access a .NET class then yes you will have to put a COM wrapper around it which does need a Strongly typed key
Message 7 of 11
Anonymous
in reply to: Anonymous

I'm just working through that file I posted from the msdn help file. that is
about all I know about the subject. I have been working with .net since
june. is there something else I can do? I can try to do it withoout the
other functions from the bat file.

thanks.
Matthew
wrote in message news:4910075@discussion.autodesk.com...
If you actaully want to access a .NET class then yes you will have to put a
COM wrapper around it which does need a Strongly typed key
Message 8 of 11
thenrich
in reply to: Anonymous

not really
sorry.
Message 9 of 11
ChrisArps
in reply to: Anonymous

To strongly name your assembly see http://andrewconnell.com/blog/archive/2004/12/15/772.aspx

You can wrap com around dotnet and use it from lisp, it works just fine. It beats the heck out of using DCL or VBA for forms.

I used it from lisp to kick a splash screen and get the CLR up and running.

Here is some VB.net code created as a new class and called AmerXSplashScreen. I have blanked out the GUID's so they don't conflict with my com object, so you will have to generate your own in the dotnet UI. Be sure you have "Register for COM Interop" checked on the build tab.

You can strongly name the assembly and install it to the GAC so Autocad can find it, or you can copy the assembly to the Autocad Program directory (good for quick development).

Option Strict On
Option Explicit On

Imports System.Runtime.InteropServices

_
Public Class AmerXSplashScreen
Implements IDisposable
' Track whether Dispose has been called.
Private mDisposed As Boolean = False

Private mFSplash As FSplashScreen


#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
' NOTE: I have blanked these out, get your own id's from the UI
Public Const ClassId As String = "********-9B28-4A2C-BBCF-0B18F857A791"
Public Const InterfaceId As String = "********-42EC-49FD-875C-91072BE5B18A"
Public Const EventsId As String = "********-A458-48AD-83C8-36B6FE589DF7"
#End Region

' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub

' Show the splash screen to the world. Will kick the CLR as a side benifit
Public Sub Show()
Try
mFSplash = New FSplashScreen()
With mFSplash
.ShowDialog()
End With
Catch ex As Exception
Trace.Fail(ex.Message, ex.StackTrace)
End Try
End Sub


' Implement IDisposable.
' Do not make this method virtual.
' A derived class should not be able to override this method.
Public Overloads Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
' This object will be cleaned up by the Dispose method.
' Therefore, you should call GC.SupressFinalize to
' take this object off the finalization queue
' and prevent finalization code for this object
' from executing a second time.
GC.SuppressFinalize(Me)
End Sub

' Dispose(bool disposing) executes in two distinct scenarios.
' If disposing equals true, the method has been called directly
' or indirectly by a user's code. Managed and unmanaged resources
' can be disposed.
' If disposing equals false, the method has been called by the
' runtime from inside the finalizer and you should not reference
' other objects. Only unmanaged resources can be disposed.
Private Overloads Sub Dispose(ByVal disposing As Boolean)
' Check to see if Dispose has already been called.
If Not Me.mDisposed Then
' If disposing equals true, dispose all managed
' and unmanaged resources.
If disposing Then
'Dispose of all child .NET objects here
If Not mFSplash Is Nothing Then
mFSplash.Dispose()
End If

End If
' Call the appropriate methods to clean up
' unmanaged resources here.
' If disposing is false,
' only the following code is executed.
' Release any memory held outside of the CLR


'Because the CLR is not always running when called from an ARX,
'Force a GC, will not get another chance later.
'NOTE!! only call this from the main dispose method of the COM object. DO NOT call
'in the child dispose methods.
GC.Collect()

End If
'Mark disposed to indicate that we are done, prevent us from disposing twice.
mDisposed = True

End Sub
' This finalizer will run only if the Dispose method
' does not get called.
' It gives your base class the opportunity to finalize.
' Do not provide finalize methods in types derived from this class.
Protected Overrides Sub Finalize()
' Do not re-create Dispose clean-up code here.
' Calling Dispose(false) is optimal in terms of
' readability and maintainability.
Dispose(False)
MyBase.Finalize()
End Sub
End Class
Message 10 of 11
Anonymous
in reply to: Anonymous

Thanks guys, I got it to work. But now how do I release the dll from memory?

Matthew

wrote in message news:4910970@discussion.autodesk.com...
To strongly name your assembly see
http://andrewconnell.com/blog/archive/2004/12/15/772.aspx

You can wrap com around dotnet and use it from lisp, it works just fine. It
beats the heck out of using DCL or VBA for forms.

I used it from lisp to kick a splash screen and get the CLR up and running.

Here is some VB.net code created as a new class and called
AmerXSplashScreen. I have blanked out the GUID's so they don't conflict
with my com object, so you will have to generate your own in the dotnet UI.
Be sure you have "Register for COM Interop" checked on the build tab.

You can strongly name the assembly and install it to the GAC so Autocad can
find it, or you can copy the assembly to the Autocad Program directory (good
for quick development).

Option Strict On
Option Explicit On

Imports System.Runtime.InteropServices

AmerXSplashScreen.EventsId)> _
Public Class AmerXSplashScreen
Implements IDisposable
' Track whether Dispose has been called.
Private mDisposed As Boolean = False

Private mFSplash As FSplashScreen


#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
' NOTE: I have blanked these out, get your own id's from the UI
Public Const ClassId As String = "********-9B28-4A2C-BBCF-0B18F857A791"
Public Const InterfaceId As String =
"********-42EC-49FD-875C-91072BE5B18A"
Public Const EventsId As String = "********-A458-48AD-83C8-36B6FE589DF7"
#End Region

' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub

' Show the splash screen to the world. Will kick the CLR as a side
benifit
Public Sub Show()
Try
mFSplash = New FSplashScreen()
With mFSplash
.ShowDialog()
End With
Catch ex As Exception
Trace.Fail(ex.Message, ex.StackTrace)
End Try
End Sub


' Implement IDisposable.
' Do not make this method virtual.
' A derived class should not be able to override this method.
Public Overloads Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
' This object will be cleaned up by the Dispose method.
' Therefore, you should call GC.SupressFinalize to
' take this object off the finalization queue
' and prevent finalization code for this object
' from executing a second time.
GC.SuppressFinalize(Me)
End Sub

' Dispose(bool disposing) executes in two distinct scenarios.
' If disposing equals true, the method has been called directly
' or indirectly by a user's code. Managed and unmanaged resources
' can be disposed.
' If disposing equals false, the method has been called by the
' runtime from inside the finalizer and you should not reference
' other objects. Only unmanaged resources can be disposed.
Private Overloads Sub Dispose(ByVal disposing As Boolean)
' Check to see if Dispose has already been called.
If Not Me.mDisposed Then
' If disposing equals true, dispose all managed
' and unmanaged resources.
If disposing Then
'Dispose of all child .NET objects here
If Not mFSplash Is Nothing Then
mFSplash.Dispose()
End If

End If
' Call the appropriate methods to clean up
' unmanaged resources here.
' If disposing is false,
' only the following code is executed.
' Release any memory held outside of the CLR


'Because the CLR is not always running when called from an ARX,
'Force a GC, will not get another chance later.
'NOTE!! only call this from the main dispose method of the COM
object. DO NOT call
'in the child dispose methods.
GC.Collect()

End If
'Mark disposed to indicate that we are done, prevent us from
disposing twice.
mDisposed = True

End Sub
' This finalizer will run only if the Dispose method
' does not get called.
' It gives your base class the opportunity to finalize.
' Do not provide finalize methods in types derived from this class.
Protected Overrides Sub Finalize()
' Do not re-create Dispose clean-up code here.
' Calling Dispose(false) is optimal in terms of
' readability and maintainability.
Dispose(False)
MyBase.Finalize()
End Sub
End Class
Message 11 of 11
ChrisArps
in reply to: Anonymous

You can't release the dll from memory as netload has loaded the assembly into Autocad's domain.

You supposedly can load an assembly into your own domain so it can be unloaded, but I have never had a use for that.

I just make sure to call dispose on the object so it can release resources when I am done with it.

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