几何尺寸与公差论坛

 找回密码
 注册
查看: 1069|回复: 0

【转帖】install a .net dll add-in again

[复制链接]
发表于 2009-4-12 21:29:16 | 显示全部楼层 |阅读模式
install a .net dll add-in again
here is the quote from solidworks website
"how to install a .net dll add-in
with .net add-ins, you can copy the bin directory to a suitable location on the target machine."
i copies the bin directory to a user's computer and here is the msg when the user tried to run the addin
"unable to initilize the add-in component"
chris
solidworks 2007 (office pro.) sp5.0
testing solidworks 2009 (pro) sp0.0
dell precision t3400
2 cpu (8500) 3.16 ghz, 3.25 gb of ram
window xp pro sp2
nvidia fx 570 6.14.11.6262
your addin does not have the required initialization/connect/disconnect functions required by an addin i would have thought. check your dll class.
luke,
i used the template from solidworks and only added more code to the template
as i said, it works fine if i manually install the addin to the solidworks; however, if i tried to put the addin to the server, then i had trouble to install it
chris
solidworks 2007 (office pro.) sp5.0
testing solidworks 2009 (pro) sp0.0
dell precision t3400
2 cpu (8500) 3.16 ghz, 3.25 gb of ram
window xp pro sp2
nvidia fx 570 6.14.11.6262
you cannot load addins off servers due to security permissions in .net i'm pretty sure. you may be able to resolve this by changing .net security permissions using the .net security management tool
you will be required to register u r .dll in gac(global assembly cache) in order to used it in users machine or other than development machine.
below mentioned is the procedure to register........
hope it ll help u.................
registering your microsoft.net add-in ensures that it is known to both the com run-time and the solidworks software. if you build your microsoft.net add-in on a development machine, then the registration is performed for you as part of the build process. during registration, the code in the function marked with the comregisterfunction attribute is executed.
to register your add-in on a machine other than the machine that you built it on, use regasm.exe at the command prompt on that machine:
> c:\windows\microsoft.net\framework\v2.0.50727\regasm.exe .dll /codebase
note: the effect of the /codebase command line argument is that the entries in the registry (hkey_classes_root\clsid) have a codebase value containing the location of the dll. this allows the microsoft .net framework (i.e., mscoree.dll) to locate the dll that implements the com object that the solidworks software tries to create when loading your add-in.
for this to work, make sure that the interop assemblies on which your add-in depends are available on the target machine because both regasm.exe and the microsoft .net run-time need them.
if you created the interop assemblies in microsoft visual studio (interop.sldworks.dll, interop.swconst.dll, interop.swpublished.dll, etc.), then make sure that the interop assemblies are copied with your add-in's dll.
if you are using the solidworks-supplied primary interop assemblies (pias) shipped with the solidworks software (e.g., solidworks.interop.sldworks.dll, solidworks.interop.swpublished.dll, solidworks.interop.swpublished.dll, etc., which reside in the solidworks installation folder where sldworks.exe also resides), then you can either copy these pias with your add-in or ensure that they are available from the global assembly cache (gac) on the target machine.
using regasm.exe will issue a warning like the following because the add-in's dll is not strongly named or signed (a microsoft .net feature).
regasm warning: registering an unsigned assembly with /codebase can cause
your assembly to interfere with other applications that may be installed on the
same computer. the /codebase switch is intended to be used only with signed
assemblies. please give your assembly a strong name and re-register it.
you can ignore this warning, as it applies to how .net searches for referenced assemblies. here we do not rely on the .net search order, as the /codebase option is required to explicitly tell com where to find the dll for an in-process server.
alternatively you can sign the add-in's assembly.
if your add-in needs to be registered on a 64-bit machine for use with solidworks x64, use the 64-bit version of regasm.exe:
> c:\windows\microsoft.net\framework64\v2.0.50727\regasm.exe .dll /codebase
this ensures the registration data for com and solidworks is added to the 64-bit of the registry.
to unregister your add-in, use regasm.exe with the /unregister option. this will execute the code in the function marked with the comregisterfunction attribute.
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 09:57 , Processed in 0.036547 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表