04-22-2016 05:29 PM
Anyone knows the name of the Act.Framework.ActFramework name to pass to CreateObject?
Most instances of the Act! Framework are created using ACTFM = New Act.Framework.ActFramework. However, that makes the code Act! version dependent. I'm trying to create the Act! Framework using ACTFM = CreateObject("act.framework.actframework") , however, the call fails.
Hence, what is the name of the Act! Framework to pass to CreateObject?
Thanx in advance.
04-25-2016 07:16 AM - edited 04-25-2016 07:18 AM
Is it even possible to do it that way? The CreateObject() call is leftover from the VB6 and prior days. It looks like it requires that the assembly is COM-accessible (https://msdn.microsoft.com/en-us/library/7t9k08y5(v=vs.90).aspx).Are the ACT assemblies COM-accessible?
Edit: Fix link
04-25-2016 09:18 AM
CreateObject was created, I think, in VB2 which over all these years has made it to VB.Net and is supported by the latest .net framework. It is a great way to create an object that is version independent.
When you use the New act.framework.actframework call, you create an Act! version dependent object. So if you compiled your code with a version 17.2 of Act! and the user is running Act! 17.1 (or 16.1 or 18.0), the creation of the object crashes.
You can create an Act! framework object using createobject("act.framework.interop.actframework") but the resulting object does not support Act! regular framework operations. So I do not know what kind of object is created.
Does anyone know of a non-version dependent mechanism to create a working Act! Framework object whether using createobject or any other call?
04-25-2016 09:31 AM - edited 04-25-2016 09:32 AM
Can't comment on CreateObject and backwards compatibility, but you can make your plugins forward compatible. The way i do it is to determine the lowest version supported by my plugin. For example, Version 16.0 + .Net 4.0. Once you add references to 16.0, expand your references section in your project, and select all Act related references. Then set the property called "Specific Version" to false, and make sure "Copy Local" is also set to false. This will ensure that your plugin will run on machines running v16.0 and up.
04-25-2016 09:53 AM
Thanx. I do that for all the code. I have seen many instances where the framework will fail. The strange thing is that on some Act! installations it works. My theory is that if the user upgrades from 16 to 16.2, it works. But if the user install 16.2 from a distribution and your initial compile is on a 16.1, it fails. From our installations, setting Specific Version and Copy Local to false does not work with the Act! Framework. On ALL cases, we have 17.2 references and the user upgrades to 18, and the framework instantiation crashes miserably. We need then to use a specific exec linked to V18 references.
Any other ideas?
04-25-2016 10:08 AM - edited 04-25-2016 10:10 AM
Well, there must be something else wrong with the project because personally, I've created plugins that target Act2007 + .NET 2.0 and they work without issues in all subsequent Act releases all the way up to v18. As long as you target .Net correctly, and don't distribute the Act dlls with your plugin, it should work on future releases.
That doesn't mean that I haven't seen some machines not work, but generally it is an issue with the Act installation. Usually, you would see a Act.Framework.dll not found error or something similar. This has to do with the dlls not being properly registered and the easiest way is to uninstall and then reinstall Act on the affected machine.
04-25-2016 10:25 AM
For example. User was using V17.2 and upgrades to V18 of Act!. The addin exec that uses 17.2 references will crash on the load. If V18 references are added, it works fine. I wish I knew why. The worst part, it does not happen on all systems.
Currently, we have to create a specific exec for each Act! version. VERY time consuming.....
04-25-2016 10:53 AM
That might be a .NET version issue.
04-25-2016 12:02 PM
Thanx. I've tried just about everything possible.
My conclusion, even though it is a real pain to create independent execs for each version of Act!, that is easier than all other options.
If only CreateObject would work this would not be an issue. One line of code to change and everything would work fine.