.net deploy plug-in dll

.net deploy plug-in dll

Gongis
Participant Participant
1,594 Views
11 Replies
Message 1 of 12

.net deploy plug-in dll

Gongis
Participant
Participant

I developed a DLL plugin for autocad Allows filling text fields from Excel using the Interop.Excel library. I want to deploy this plugin, and from a security perspective, I was wondering if placing this DLL on a server and creating a database for authorized users would allow it to work as it would on a local machine. Will the code execute on the server or on the client machine? Please note that I don’t have much knowledge about backend development, which is why I’m asking these questions to see if I’m on the right track to learning ASP.NET. Thank you in advance for your help.

0 Likes
1,595 Views
11 Replies
Replies (11)
Message 2 of 12

Ed__Jobe
Mentor
Mentor

Let's clarify the problem. Are you trying to create a method that only allows authorized users to run the code or are you trying to create a deployment scheme?

 

BTW, I don't think you have the correct idea of what a back end database is. It's just the data store and there is a separate app that is the front end where you work with the data. An Access mdb is a case where both the forms, etc. used to access the data and the data are in the same file. And you don't need asp to work with either. Visual Studio has objects built in that make it easy to work with databases. ASP (Active Server Pages) is used where you have a dedicated web server to host the app or "serve" up pages to the user.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 12

Gongis
Participant
Participant

Thank you for your response.My objective is that I don’t want to install the DLL plugin I developed on the user’s machine. I want to host it remotely on a server or in the cloud and create a database of authorized users who can access this DLL.What is the best approach to achieve this? @Ed__Jobe 

0 Likes
Message 4 of 12

Ed__Jobe
Mentor
Mentor

Ok, you want to do both...

You should be good to netload a dll from a network server. I do this when debugging. You just have to add the path to the TrustedFolders list.

I have a dll that checks a db (could simply be a file with a list of users) to see if they need any updates. You could use this to check the list of approved users and if they are on the list, then set a boolean true. Then add a check to each command to see if the boolean is true, then run the command, else exit the sub. I don't expect you to use the code as-is. It's just to give you an idea.

 


    Public Class MyPlugin
        Implements IExtensionApplication

        Public Sub Initialize() Implements IExtensionApplication.Initialize

            ' Initialize your plug-in application here
            Try

                Dim AcadApp As AcadApplication = acApp.AcadApplication
                Dim docMgr As DocumentCollection = acApp.DocumentManager
                Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
                Dim ds As CadmgrDataSet = New CadmgrDataSet
                Dim taLog As CadmgrDataSetTableAdapters.LogTableAdapter = New CadmgrDataSetTableAdapters.LogTableAdapter
                Dim dtLog As CadmgrDataSet.LogDataTable = taLog.GetData()
                Dim taMgr As CadmgrDataSetTableAdapters.TableAdapterManager = New CadmgrDataSetTableAdapters.TableAdapterManager
                My.User.InitializeWithWindowsUser()
                Dim parts() As String = Split(My.User.Name, "\")
                Dim strUser As String = parts(1).ToUpper


                ' This startup procedure uses sequential Try..Catch blocks so that a 
                ' failure in one does not prevent others from loading.

CheckForUpdates:  ' See if updates required.
                Try
                    UpdatesRequired()
                Catch ex As System.Exception
                    ed.WriteMessage(vbCrLf & "CheckForUpdatesFailed.")
                    taLog.Insert(strUser, Now(), "CheckForUpdatesFailed: " & ex.Message & " " & My.Computer.Name)
                    taLog.Update(dtLog)
                End Try

 

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 5 of 12

My_Civil_3D
Advocate
Advocate

I Do he Same for my Plugins. What i have done is i Handle Authenticated users via my online server including my plugin installation and updated. to Ease the installation process i have created a standalone windows application that handles the installation of my plugins and also handles any updates.

Civil 3D Certified Professional
Message 6 of 12

Gongis
Participant
Participant

Could you further clarify the part about installing a plugin from the server, or provide a code snippet to get started? Thank you in advance

0 Likes
Message 7 of 12

Ed__Jobe
Mentor
Mentor

It's just a matter of copying the dll to the user's pc. There are many ways to do it. You can use a bat file with XCOPY command. @My_Civil_3D and I use a custom exe that does the copying. My exe can accept arguments of what to copy. My startup dll, queries the db to find out what the user needs and then passes that as an argument to the exe.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 8 of 12

Domzinator
Advocate
Advocate

I have something simular. Autocad Plugin generally exists from .dll files. So all my Windows application does is copy the .dll files from my server to a location that i have set out on the user pc. then i also have a .lsp file that the program put in the autodesk support folder to autoload the plugin. and that is it.  for versions i control from mysql and have writen a "check update" in my autocad plugin that checks for a new version. once there is an update the user simply closes autocad and updates the files.

With this my Program auto changes settings/paths needed for it to work every time the plugin is loaded.

 

 

Civil 3D Certified Professional
Message 9 of 12

Gongis
Participant
Participant

Thank you for your response. My objective is to host the plugin on my server and create a database or a file of authorized users on the server. I would like to autoload the DLL directly from the server to the users' AutoCAD, without copying the plugin to the user's PC

0 Likes
Message 10 of 12

norman.yuan
Mentor
Mentor

It seems to me that your question is actually about 2 issues: only "licensed" user can run your plugin; secure the plugin DLL to prevent "physical access" (so some one may decompile the DLL to see the code logic).

 

Since you want to somehow "licensing" the plugin, obviously, the user would be the public AutoCAD users at large, not internal users in a corporation, right? The simplest way would be publish the plugin to Autodesk's App store and take advantage of its user entitlement API. That means you code the entitlement verification into the plugin, so when the plugin loads, or a command of the plugin runs, the code would use the entitlement API to access Autodesk's app store to verify if the user's entitlement status and let the plugin's continue/quit accordingly.

 

There maybe other third party licensing management online services available, playing the same/similar role as Autodesk app store's entitlement APIs. Or, if you are capable and have time to kill, you could re-invent the wheel (be prepared to invest times much more than you do your plugin), I'd say it is likely not worth it, unless your plugin has significant market value.

 

As for loading plugin DLL from "server", you may want to clarify what "server" means. if the server is just a computer in your internal organization (LAN), the dll is located in a network share/drive, then, yes, you can place a single copy of the DLL there and have all users in the same LAN to load it. However, you need to tweak the acad.exe.config of each AutoCAD installation to allow .NET DLL from outside the running computer to be loaded/executed. If the "server" means a invisible location of the internet, then, no, you cannot load the DLL directly from there. You need first download the DLL as binary data and save to the location computer; then Windows would automatically flag a downloaded executable as "unsafe" and you must manage to prompt user and manually flag he downloaded file as safe before it can be loaded into AutoCAD. If your users are public at large, I'd bet users would think they have downloaded a harmful ware and refuse to use it. 

 

So, you should let your user to deploy/install your plugin locally. If you are truly concerned about protecting the code logic from decompiling the DLL and the code logic has the extremely high technology/commercial value, you may want to develop your plugin in ObjectARX C++ instead. The truth is, for a experienced/good AutoCAD programmer, once seeing how a plugin runs, he/she probably can develop a more or less similar plugin without having to other's source code, unless the plugin is extremely complicated.

 

Again, if your target users are the public at large, forget about loading the DLL from "server", and take advantage of Autodesk's App Store.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 11 of 12

Owackenreuther
Advocate
Advocate

Is your objective to load the DLL file from a network path so that you can update it at anytime and ensuring that all users have the same version loaded?

If so, then I believe that this approach does not work because once the DLL is loaded it is locked by the first user. You can create a program that copies the DLL on load to user's local before netloading it.

0 Likes
Message 12 of 12

daniel_cadext
Advisor
Advisor

I have that in the app store

XLSX Field Evaluator https://apps.autodesk.com/ACD/en/Detail/Index?id=4867035866745163447&appLang=en&os=Win64

I used the entitlement API , https://damassets.autodesk.net/content/dam/autodesk/www/adn/pdf/entitlement-api-for-desktop-apps.pdf

Maybe have a look at that for inspiration

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes