I am getting the error below when trying to register this addin
RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can ca
use 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.
RegAsm : error RA0000 : Could not load file or assembly 'SolidWorksTools, Versio
n=2.0.0.0, Culture=neutral, PublicKeyToken=bd18593873b4686d' or one of its depen
dencies. The system cannot find the file specified.
Any ideas what SolidWorksTools, Version=2.0.0.0 is and why it cant be located?
SolidworksApi macros
can you see the SolidWorksTools DLL fill
if so try to place it in the C:\Windows\assembly folder
is this the first time you tried to register an addin?
solidworkstools.dll is located in my C:\Program Files\SolidWorks folder
I took a look at the C:\Windows\Assembly folder, doesnt look like a typical file folder. How do you copy/add a file to that folder
btw, I am running WinXP Pro.
Drag and drop should do it
also it might be a differnt file this is missing or curputed that solidworksTool uses
you might need to uninstall and re-install SW
GACUTIL : http://msdn.microsoft.com/en-us/library/ex0ss12c%28VS.80%29.aspx
I don't have solidworkstools in my GAC...
What are you using from SolidWorksTools anyway?
If it's the attribute then create it inside your addin project:
[<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.AttributeUsageAttribute/.ctor%28System.AttributeTargets%29" title="System.AttributeUsageAttribute.AttributeUsageAttribute(AttributeTargets);" data-community-id="1">AttributeUsage</a>(<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AttributeTargets" title="System.AttributeTargets" data-community-id="1">AttributeTargets</a>.<a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.AttributeTargets/Class" title="AttributeTargets System.AttributeTargets.Class;" data-community-id="1">Class</a>)]<span style="color: #1000a0;">public</span> <span style="color: #1000a0;">class</span> <strong><a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://SolidWorksTools:2.0.0.0:bd18593873b4686d/SolidWorksTools.SwAddinAttribute" data-community-id="1">SwAddinAttribute</a></strong> : <a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Attribute" title="System.Attribute" data-community-id="1">Attribute</a>{ <span style="color: #808080;">// Fields</span> <span style="color: #1000a0;">public</span> <a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.String" title="System.String" data-community-id="1">string</a> <strong><a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://SolidWorksTools:2.0.0.0:bd18593873b4686d/SolidWorksTools.SwAddinAttribute/Description:String" data-community-id="1">Description</a></strong> = <span style="color: #800000;">""</span>; <span style="color: #1000a0;">public</span> <a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.Boolean" title="System.Boolean" data-community-id="1">bool</a> <strong><a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://SolidWorksTools:2.0.0.0:bd18593873b4686d/SolidWorksTools.SwAddinAttribute/LoadAtStartup:Boolean" data-community-id="1">LoadAtStartup</a></strong>; <span style="color: #1000a0;">public</span> <a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.0.0:b77a5c561934e089/System.String" title="System.String" data-community-id="1">string</a> <strong><a href="http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://SolidWorksTools:2.0.0.0:bd18593873b4686d/SolidWorksTools.SwAddinAttribute/Title:String" data-community-id="1">Title</a></strong> = <span style="color: #800000;">""</span>;}Have you tried "Register for Com Interop" with tagged methods: [ComRegisterFunctionAttribute] and [ComUnregisterFunctionAttribute] ? This way your dll will register itself during comile.
Don't add it to the GAC it is not needed. If it is failing to find the file, check that your References has the SolidWorksTools.dll file added. Best removing it and re-adding the reference so you browse for the file location yourself.
Rebuild and if it still fails, check that if you have multiple configurations (x86 and x64) that it builds for both.
I had to install VB Express and open the addin project up. The references were fixed automatically and I rebuilt the addin. Registering the addin works now.
Question: Does solidworkstools.dll have to be located in the same place on whatever machine the addin is installed on?
If Solidworkstools.dll is not in the GAC then yes it has to be distributed with your app.
That entire dll is about 100 lines of code, you might as well reflect it and drop the code directly into your addin. http://www.red-gate.com/products/reflector/
If you are using .Net 4 you can embed the reference file into the exe using VS it has built in tools for doing that without needing to pay for extra tools. Just select the reference and right-click->Properties...and select Embed Interop Types to true.
How can I verify if its in my GAC? I would have to verify this on all users machines who will be using the addin, correct?
As a general rule no you don't check the users GAC for a reference you need and then do something based on that. Typically you check the existence of a library file in your installer whatever you choose to use, by either checking the COM registry, known file locations and optionally but not typically the GAC. And if it isn't there don't install.
Instead of that what is more common is you supply the dll in your installer bootstrapper or general installer package to install along with your product either to the GAC using the installer so it is removed upon reinstall, or just to the same folder as your program.