Click or drag to resize
Auto-References (VB.NET)

CUSTOMTOOLS script add-ins may require some referenced assemblies (.dll files) in order to have wider range of functionality available. You can select the dll assembly references by using the Referenced Assemblies options in script add-in management available in the CUSTOMTOOLS Administration Tool, but you can also determine the referenced dll assemblies in the beginning of your script's source code.

This topic shows how you can setup the automatic dll references in your Visual Basic.NET script code.

Automatic DLL Assembly References (VB.NET)

As described above, selecting the dll assembly references could be done manually, but you can also setup the dll assembly references automatically in your script add-in's source code.

Syntax

Use the following syntax to add the automatic dll assembly references. Please note that the automatic dll assembly references have to be defined on the very first lines of your script's source code.

VB
' @auto-reference {<DllFilePath>\<DllFileName.dll>}

Attributes

Paths of the script add-in's automatic assembly references could be defined manually or, you can use the following pre-defined attributes to setup the dll file path automatically.

Attribute

Description

[CT_INSTALL_PATH]

Installation path of the CUSTOMTOOLS products. By default the [CT_INSTALL_PATH] attribute points to the C:\Program Files\ATR Soft\CUSTOMTOOLS 2018\

[ASSEMBLY_PATH]

The [ASSEMBLY_PATH] attribute points to the path where the referenced file is located in. This attribute should be used in case when the referenced assembly is located in a path that is not the add-in's target path but, the referenced file is required by the add-in's functionality. The [ASSEMBLY_PATH] could be used properly only with the reference assemblies that are uploaded to the script add-in as the script's Additional files.

Example

The following example code shows an example about how you can add the automatic dll assembly references in your script's source code.

In the example, several auto-references has [CT_INSTALL_PATH] defined as the DLL file path. The [CT_INSTALL_PATH] is a pre-defined attribute which means the installation path of the CUSTOMTOOLS version the script add-in is being used with. For example in case that the script add-in is used with the CUSTOMTOOLS 2018 version, the [CT_INSTALL_PATH] attribute is considered as the installation folder path where the CUSTOMTOOLS 2018 is installed in. Default installation path of the CUSTOMTOOLS 2018 is C:\Program Files\ATR Soft Oy\CUSTOMTOOLS 2018\.

VB
' @auto-reference {[CT_INSTALL_PATH]\Interop.CTEngineLib.dll}
' @auto-reference {[CT_INSTALL_PATH]\Interop.ATRControlsXLib.dll}
' @auto-reference {[CT_INSTALL_PATH]\microsoft.office.interop.excel.dll}
' @auto-reference {[CT_INSTALL_PATH]\Office.dll}
' @auto-reference {[CT_INSTALL_PATH]\EPDM.Interop.epdm.dll}
' @auto-reference {[CT_INSTALL_PATH]\CTInterface.dll}
' @auto-reference {[CT_INSTALL_PATH]\SolidWorks.Interop.swconst.dll}
' @auto-reference {C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Drawing.dll}
' @auto-reference {C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.XML.dll}
' @auto-reference {C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Windows.Forms.dll}

Imports System
Imports System.IO
Imports System.Xml
Imports System.Text
Imports System.Diagnostics
Imports System.Drawing
Imports System.Globalization
Imports System.Reflection
Imports System.Windows.Forms
Imports System.Collections.Generic
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Core
Imports SolidWorks.Interop.swconst
Imports EPDM.Interop.epdm
Imports ATR.CT.CTInterface
Imports ATRControlsXLib

Public Class ExampleClass
  ' My script code...
End Class
See Also