swApp = GetObject(, "SldWorks.Application")
do you have reference to SolidWorks.Interop.sldworks.dll
from this map : <SolidWorks_install_dir>\api\redist or <SolidWorks_install_dir>\api\redist\CLR2 if you use Microsoft .NET Framework Version 2.0.?
But I might have solved it, or I believe it works now:
swApp = GetObject("", "SldWorks.Application.22")
22 is added for solidworks 2014, it seems to work and my rebuild is now successfull, or the codes tell me that it is. No extra instance of solidworks is started as well.
So I need to change 22 is its running with other versions of solidworks I guess.
swApp = System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application")
Catch SolidWorksConnectError As Exception
This way you won't have to have your code version number specific.