I am trying to create a CodeActivity object that will register a DLL on a remote system during TFS build. I successfully impersonate my own user account, which has administrator rights to my machine. (I am trying to register the DLL on my computer at the moment.) Please note that all attempts worked if I run the workflow locally, but not from the build server. Also, if I manually run regsvr32, the DLL will correctly register and unregister.
This is the heavily stripped-down code I'm using:
Private DllType As Type 'Type of the DLL being registered is handled elsewhere'
Dim Result As Integer
Result = CInt(DllType.InvokeMember("DllUnregisterServer", BindingFlags.InvokeMethod, Nothing, Activator.CreateInstance(DllType), Nothing))
When I run it, I get this message, most relevant, probably with an internal exception: "Cannot find an entry point with the name" DllUnregisterServer "in the DLL" RptBarcodeLabel.dll "
Error = An exception was thrown by the target of the call., Stack = at System.RuntimeMethodHandle._InvokeMethodFast (IRuntimeMethodInfo method, Object target, Object [] arguments, SignatureStruct & sig, MethodAttributes methodAttributes, RuntimeType typeOwner) in System.RuntimeMethethododle method target, Object [] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) in System.Reflection.RuntimeMethodInfo.Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object [] parameters, CultureInfo culture, Boolean skipVisibilityChecks). RuntimeMethodInfo.Invoke (Object obj, BindingFlags invokeAttr, binder, Object [] parameters, CultureInfo culture) in System.RuntimeType.InvokeMember (String name, BindingFlags bindingFlags, Binder binder,Object target, Object [] provided by Args, ParameterModifier [] modifiers, CultureInfo culture, String [] namedParams) in System.Type.InvokeMember (string name, BindingFlags invokeAttr, binder, object target, object [] args) in TfsCopyFile.DllRegServer. InternalRegServer (Boolean fUnreg) in TfsCopyFile.DllRegServer.UnRegister () in TfsCopyFile.TfsRegisterDLL.Execute (context CodeActivityContext), internal exception = cannot find an entry point named "DllUnregisterServer" in DLL Rpt ".InternalRegServer (Boolean fUnreg) in TfsCopyFile.DllRegServer.UnRegister () in TfsCopyFile.TfsRegisterDLL.Execute (context CodeActivityContext), internal exception = cannot find an entry point named "DllUnregisterServer" in DLL Rpt ".InternalRegServer (Boolean fUnreg) in TfsCopyFile.DllRegServer.UnRegister () in TfsCopyFile.TfsRegisterDLL.Execute (context CodeActivityContext), internal exception = cannot find an entry point named "DllUnregisterServer" in DLL Rpt ".
DLL. , TFS.