Add Reference .dll Error

Add Reference .dll Error

a81383
Enthusiast Enthusiast
291 Views
2 Replies
Message 1 of 3

Add Reference .dll Error

a81383
Enthusiast
Enthusiast

 

Receiving the following error when trying to add the following dll as a reference. 

 

iLogic ERROR:

Error on line 39 in rule: Form Builder External, in document: 11118.iam

 

Could not load file or assembly 'System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken= or one of its dependencies. The system cannot find the file specified.

 

iLogic Rule:

AddReference "C:\Users\Documents\Form Builder Visual Studio - Test\MyNewForm\bin\Debug\net6.0-windows\MyNewForm.dll"
Sub Main() 
Using dlg As New MyNewForm.Form1

	dlg.Parameter = Parameter
	dlg.MultiValue = MultiValue
	dlg.iLogicVb = iLogicVb


Dim i As Integer = dlg.ShowDialog()
If i <> vbOK Then Return

End Using

iLogicVb.UpdateWhenDone = True

End Sub

DLL:

Imports System.Windows.Forms
Imports Autodesk.iLogic.Interfaces

 

Public Class Form1
Public Parameter As IParamDynamic
Public pTest As IParamDynamic
Public Multivalue As IMultiValueParam
Public iLogicVB As ILowLevelSupport


Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
iLogicVB.RunRule("Custom Form Test")
End Sub
End Class

 

0 Likes
292 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @a81383.  The full file path you are specifying in the 'AddReference' line does not look correct.  It looks like it is missing a specific user directory between the "Users" & "Documents" directories...unless you are just leaving that out for privacy purposes.  Plus, I think you are supposed to put any DLL type files that you want to reference from iLogic rules into a special location mentioned within the online help documentation.  Below is a link to the online help page which mentions this:

Advanced iLogic Techniques Reference 

Also, I don't think you can simply create that DLL file with something like notepad.exe.  However, we can convert an external iLogic rule into a file that we can reference similarly, using the AddVbFile technique, or reference another internal rule using the AddVbRule technique, once you have turned on their 'Straight VB Code' option, and properly formatted the code in those rules that you plan on referencing.

And your code for the DLL seems to include 2 Sub routines for reacting to button clicks, but it does not seem to include any code for creating the form or those two buttons within it, so they would not have anything to react to.  Have you simply not included all of the code?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

a81383
Enthusiast
Enthusiast

Hi @WCrihfield, yes I did alter the file path to hide some personal information. Which I should have made more clear with some ... or something. Sorry about that! I am working through visual studio to create the dll. Which is my first time working in this environment. I think I got a bit ahead of myself posting here so soon and will certainly continue to research how to built complex user forms. But I really appreciate your response and will look into to improving my code and will utilize the special location for referenced rules moving forward.

 

Thank you!

0 Likes