I'm attempting to create a Solidworks plugin with AngelSix's SolidDna library. I've used the standard setup as per the examples:
public class Integration : AddInIntegration
{
// All overrides left blank
public override void ApplicationStartup()
{
}
public override void ConfigureServices(FrameworkConstruction construction)
{
}
public override void PreConnectToSolidWorks()
{
}
public override void PreLoadPlugIns()
{
}
}
public class MySolidDnaPlugin : SolidPlugIn
{
public override string AddInTitle { get; } = "foo";
public override string AddInDescription { get; } = "bar";
public override void ConnectedToSolidWorks()
{
// This works fine...
Boo.Lang.List l = new Boo.Lang.List();
// ....But this doesn't :(
Boo.Lang.Compiler.BooCompiler c = new Boo.Lang.Compiler.BooCompiler();
}
public override void DisconnectedFromSolidWorks()
{
}
}
I'm attempting to add support for scripting in Boo, so users can edit the scripts on the fly. I've added a reference to Boo.Lang.dll, Boo.Lang.Compiler.dll and Boo.Lang.Parser.dll, and all 3 DLLs are definitely copied to the /bin folder.
I'm able to use classes from the Boo.Lang namespace, but as soon as I try and use the Boo.Lang.Compiler namespace it throws an error:
Could not load file or assembly 'Boo.Lang, Version=2.0.9.4, Culture=neutral, PublicKeyToken-32c39770e9a21a67' or one of its dependencies. The system cannot file the file specified.
The same code/setup works fine when running outside Solidworks, e.g. in a console app.
The SolidDna docs show the process of registering the plugin DLLs with regasm.exe /codebase
, so I tried running that with the 3 Boo DLLs, but that doesn't make any difference.
Any suggestions or pointers?
My guess would be that you added those binaries to addin folder, while process is looking for those files in solidworks.exe folder.
I suggest you to confirm it with ProcMon tool.
If that is the case there are multiple ways to resolve this:
1 add those binaries to solidworks folder
2 add those folders to any of the folders in the path environment variable
3 add your addin folder to path environment variable
4 If those binaries as well as your addin are .net assemblies you can use ilmerge to combine them into one.
5 If your addin is .net assembly and you have access to appdomain object you can subscribe to AssemblyResolve event and provide path dynamically.