GUID's for addins

GUID's for addins

Anonymous
Not applicable
889 Views
5 Replies
Message 1 of 6

GUID's for addins

Anonymous
Not applicable
I'm using VS2005 for some simple IV development and have a couple
questions concerning its use. Yes, I know that the 2.0 framework is not
"officially" supported, but I have got it to work after modifying IV's
config file. Obviously I cannot use the "wizards", but I did get some
benefit by going through the wizard install anyway, I was able to
extract some good templates for addin creation. That leads to my first
question. In said templates there are a few placeholders where the
wizard would plug in some information during project creation which I
must now plug in manually. On the file "AssemblyInfo.vb" one placeholder
is "Project_Name". Not to hard to figure out what goes in there. The
next placeholder in this file is "Assembly: Guid", this is one that I
don't know how to get a value for.
The next file is "StandardAddinServer.vb" (which does not appear in all
the samples, I thought it was mandatory?). Again "Project_Name"
placeholder is here, no biggy. There is also a placeholder called
"GuidAttribute", again I don't know how to arrive at a value for this.

So, should I just make up values for these GUID's?, its worked so far
but there must be a preferred method.

My next question concerns the file "AddinRegistration.vb", which has no
placeholders to deal with, but seems redundant.
This file creates the standard registry entries that IV needs to
discover an addin but obviously it cannot add those entries until the
addin executes. But, the addin will not execute until IV knows its
there, which it will not because the needed registry enties don't exist
yet! Catch-22 anyone?
What I'm getting at here is that for your addin to work you must create
a .reg file for it and run that prior to starting up IV (just like the
old VB6 addins. Thus, in packaging .net addins you must still have this
.reg file and install it during addin installation).
So why have a "AddinRegistration" code file if the info its placing in
the registry is already there?

Thanks for any insight
Perry
0 Likes
890 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

If you want the wizards for VS 2005, the following
is a link to the posting on the customer-files newsgroup that has the installer
as an attachment (the installer will install the addin templates for vb.net and
vcsharp.net):


 

This will be available in the SDK when Inventor
2008 is released. The installation of this wizard requires the uninstallation of
the current version that you have. But, if you install this newer one, you will
still get the wizards for VS 2003 (and 2005).

 

Hopefully with this you wouldn't need to modify the
templates installed by the previous version of the wizard.

 

Some answers to your questions:

So, should I just make up values for these GUID's?,
its worked so far but there must be a preferred method.

>> The GUID is a unique identifier for the
CLSID of the addin. These are gauranteed to be unique if you go to the "Tools
-> Create GUID" menu option in Visual Studio 2005 and use that dialog to
generate a new GUID. If you make up values, then they might not be
unique.

 

But, the addin will not execute until IV knows its
there, which it will not because the needed registry enties don't exist yet!
Catch-22 anyone?

>> The addins registry entires are added when
the addin is compiled using Visual Studio 2005 (if the register for COM Interop
option is specified). So, if the addin compiles alright, if you start Inventor,
it will find the addin because it will be registered.

 

What I'm getting at here is that for your addin to
work you must create a .reg file for it  and run that prior to starting up
IV (just like the old VB6 addins.

>> You don't need a .reg file to
merge the Inventor required registry settings when using VB.NET. This
is required only for VB 6.0 because it did not allow overriding the
DllRegisterServer and DllUnregisterServer functions. VB.NET
allows you to add the <ComRegisterFunctionAttribute()> and
<ComUnregisterFunctionAttribute()> attributes to functions in your code
and so these will be called then assembly is registered and unregistered for COM
interop. So, you can write code to add the registry settings when the addin
assembly is registered and remove these when the addin assembly is
unregistered.

 

-Venkatesh Thiyagarajan.





 

I'm using VS2005 for
some simple IV development and have a couple
questions concerning its use.
Yes, I know that the 2.0 framework is not
"officially" supported, but I have
got it to work after modifying IV's
config file. Obviously I cannot use the
"wizards", but I did get some
benefit by going through the wizard install
anyway, I was able to
extract some good templates for addin creation. That
leads to my first
question. In said templates there are a few placeholders
where the
wizard would plug in some information during project creation
which I
must now plug in manually. On the file "AssemblyInfo.vb" one
placeholder
is "Project_Name". Not to hard to figure out what goes in there.
The
next placeholder in this file is "Assembly: Guid", this is one that I

don't know how to get a value for.
The next file is
"StandardAddinServer.vb" (which does not appear in all
the samples, I
thought it was mandatory?). Again "Project_Name"
placeholder is here, no
biggy. There is also a placeholder called
"GuidAttribute", again I don't
know how to arrive at a value for this.

So, should I just make up values
for these GUID's?, its worked so far
but there must be a preferred
method.

My next question concerns the file "AddinRegistration.vb", which
has no
placeholders to deal with, but seems redundant.
This file creates
the standard registry entries that IV needs to
discover an addin but
obviously it cannot add those entries until the
addin executes. But, the
addin will not execute until IV knows its
there, which it will not because
the needed registry enties don't exist
yet! Catch-22 anyone?
What I'm
getting at here is that for your addin to work you must create
a .reg file
for it  and run that prior to starting up IV (just like the
old VB6
addins. Thus, in packaging .net addins you must still have this
.reg file
and install it during addin installation).
So why have a "AddinRegistration"
code file if the info its placing in
the registry is already
there?

Thanks for any insight
Perry
0 Likes
Message 3 of 6

Anonymous
Not applicable
No comment eh?

I did further research and experimentation and was able to answer most
of these questions myself. I found the reason for the seeming redundancy
of the "AddinRegistration.vb" file. The registry info contained therein
will be applied when the addin is registered via "regasm", so a .reg
file is not necessary.
On the question of GUID's. I found a document called "how to create an
addin for inventor using visual basic.net" (don't remember if I found it
on Charles site or Seans), it provided one good clue but it needs work.
For example, it stated that the "GuidAttribute" would be generated by VS
if you just create a new class project. It showed a snippet which came
from the file "standardaddinserver". Thats not quite right. What VS will
generate is the "assemblyinfo" file which contains the "Assembly: Guid"
which is different. But at least I got that much. Also troubling about
this doc is that it says you must add your assembly (and a modified
Inventor assembly) to the GAC. I see no reason for this and don't see it
done anywhere else. Correct me if I'm wrong.
I then discovered Neil Munro's "micky mouse" addin which was VERY
helpful (The only COMPLETE addin, with install info and extra comments,
that I've seen so far).
Thanks a bunch Neil !!
This provided the missing info on how to the the "GuidAttribute" (from
the Guid generator tool), now that I knew how to get the "Assembly Guid".
All holes plugged now. Created a new class project, added the
"standardaddinserver" and "addinregistration" files, got my CLSID's and
it seems to work fine. Maybe I should write my own tutorial on this !

Perry
0 Likes
Message 4 of 6

Anonymous
Not applicable
Thanks Venkatesh, that is helpful. Looks like you were writing your
reply about the same time I was!
couldn't get the link to work, but I'll browse CF and try to find it.

Perry
0 Likes
Message 5 of 6

Anonymous
Not applicable
Thanks for the wizards Venkatesh !
Sure is easier than doing my hack job, but at least I learned something
along the way 🙂

Perry
0 Likes
Message 6 of 6

Anonymous
Not applicable
I was also looking some thing like this and I am able to create and load Add-in with vb2005 but not able to continue it with additional forms. can you please post the link to this

"Neil Munro's "micky mouse" addin which was VERY
helpful (The only COMPLETE addin, "

thanks
0 Likes