|
how do i create an installer api project??
hi,
i was developed api project on vb.net 2005 and addin on solidworks 2008. then i want to create setup file (.dll) for using that project on another computers. how do i create them? i try to using "setup wizard" to create an installer. it's don't work.
regard
shukree,
this will be covered in full in my next book. but yes setup project is what you need to start but it gets complicated with sw add-in registration and even more so when it comes to multi-platform and x64bit msi installers etc...
there are a few things that are easy to miss. this all assumes 32bit swx. as luke mentioned, it's different for 64bit since installers are platform specific.
1. use the setup project's registry settings to set the following key:
hkey_local_machine\software\solidworks\addins\{xxxxx}
you can find the guid in the swaddin code file at the top of the swaddin class definition.
the key shown above as {xxxxx} must be the guid for your dll.
2. inside that key, create two string values - one named title and the other description. this is what the user will see in the solidworks add-ins list.
3. using the project's registry settings, set the following key:
hkey_classes_root\clsid\{xxxxx}\inprocserver32
again, the {xxxxx} should be your dll's guid.
4. in the inprocserver32 key, create the following string values:
(default) value = "mscoree.dll"
class value = "yourassembly.swaddin"
*** the value must be your project's assembly name (find under my project, application, assembly name) and the name of your add-in class. for example, the template's add-in class is named "swaddin".
codebase value = "file:///[targetdir]yourassembly.dll"
*** yourassembly.dll is your dll name.
threadingmodel value = "both"
that should be enough to get it registered properly. if anyone sees anything i'm missing, please chime in.
mike spens
"automating solidworks using macros"
leap frog leap pad x64
there is a nice easy way to get your plugins to register and unregister themselves using the visual studio install project using an installer class.
i had a lot of problems getting installers to work when i first tried. you can add an install project to your solution and set it to register your addin with com and it does - except it does not excecute the custom register and unregister methods of your addin.
i didn't like the idea of having to manually create registry entries to be excecuted during install so a lot of searching on the web produced the following (assuming you started from the swaddin wizard) :
this works for 32bit windows xp, i haven't tried any other systems so maybe someone can try and let me know. also you may not be able to do this with visual studio express (i'm pretty sure you can't so don't spend too mucjh effort trying!), you might need to get standard or professional.
(1)
add an installer class to your addin project and paste in the following code:
imports system.componentmodel
imports system.configuration.install
imports system.runtime.interopservices
public class installer1
public sub new()
mybase.new()
'this call is required by the component designer.
initializecomponent()
'add initialization code after the call to initializecomponent
end sub
public overrides sub install(byval statesaver as system.collections.idictionary)
mybase.install(statesaver)
dim regsrv as new registrationservices
regsrv.registerassembly(mybase.gettype().assembly, assemblyregistrationflags.setcodebase)
end sub
public overrides sub uninstall(byval savedstate as system.collections.idictionary)
mybase.uninstall(savedstate)
dim regsrv as new registrationservices
regsrv.unregisterassembly(mybase.gettype().assembly)
end sub
end class
(2)
add an installer project to your solution:
file->add-> new project
poject type: setup and deployment
template: setup project
add your addins primary output as the source for the installer project:
right click your setup project and add project output
choose your addins primary output and confirm
select your addins primary output as the install and uninstall custom action:
right click your setup project
choose add->custom action
the custom actions tab will appear
right click the install folder and add you projects primary output
do the same for the uninstall folder
(3)
look for the primay output of your setup project in the solution explorer
click on it and look in the properties change its register flag to vspdadonotregister
the installer class will do this for us.
build your installer class and voila all done for you much easier and will call the following code of your addin:
public shared sub registerfunction(byval t as type)
and
public shared sub unregisterfunction(byval t as type)
hope this is helpful.
cheers
tom mulder
regards
tom mulder.
compac nw8440
intel core 2 t7400 2.16ghz
ati mobility firegl v5200
solidworks 2008 sp4.0
windows xp professional sp2
edited: 08/08/2008 at 09:34 pm by thomas mulder
mike,
i followed the steps you described above, the the addin seems to register ok but when i try to launch it in solidworks i get an error message saying that "either the addin or one of its components are missing"
do you have any idea why?
cheers,
--stav.
edit: i have been searching in my registry and i have noticed that under:
hkey_classes_root
there exists a registry entry for each of the classes that are included in the addin e.g:
hkey_classes_root\assemblyname.swaddin
this has a key named clsid with a string named (default) with value the guid of the addin.
do i need to create a key in my setup project for each class included in the addin?
in this world i am nobody...
and nobody is perfect ;) !!!
---------
solidworks office 2008 sp4.0
dell precision pws390
nvidia quadro fx 3450/4000 sdi
edited: 09/09/2008 at 06:29 am by stavros antoniou
the above code will not registry itself correctly or add the registry entries required as the msi installer does not run the .net registry service just the com registry.
this is a problem i encountered when creating my installers and it was a documented bug in vs setup projects that has not been fixed yet that i am aware of. i had to do some trick code to get my programs to register on install.
if you get it working it would be interesting to see the solution. good luck.
hi i am a new developer and i have the problem as you describe here. have you found any solution ?
i just saw this reply and it works !!!
so whoever is still interested in creating an installer class followthe steps described below by tom and you will be able to create an installer for your addins.
if you have any issues reply here and i'll try to help where i can.
once again thanks tom!!!
cheers,
--stav.
originally posted by: thomas mulder
there is a nice easy way to get your plugins to register and unregister themselves using the visual studio install project using an installer class.
i had a lot of problems getting installers to work when i first tried. you can add an install project to your solution and set it to register your addin with com and it does - except it does not excecute the custom register and unregister methods of your addin.
i didn't like the idea of having to manually create registry entries to be excecuted during install so a lot of searching on the web produced the following (assuming you started from the swaddin wizard) :
this works for 32bit windows xp, i haven't tried any other systems so maybe someone can try and let me know. also you may not be able to do this with visual studio express (i'm pretty sure you can't so don't spend too mucjh effort trying!), you might need to get standard or professional.
(1)
add an installer class to your addin project and paste in the following code:
imports system.componentmodel
imports system.configuration.install
imports system.runtime.interopservices
public class installer1
public sub new()
mybase.new()
'this call is required by the component designer.
initializecomponent()
'add initialization code after the call to initializecomponent
end sub
public overrides sub install(byval statesaver as system.collections.idictionary)
mybase.install(statesaver)
dim regsrv as new registrationservices
regsrv.registerassembly(mybase.gettype().assembly, assemblyregistrationflags.setcodebase)
end sub
public overrides sub uninstall(byval savedstate as system.collections.idictionary)
mybase.uninstall(savedstate)
dim regsrv as new registrationservices
regsrv.unregisterassembly(mybase.gettype().assembly)
end sub
end class
(2)
add an installer project to your solution:
file->add-> new project
poject type: setup and deployment
template: setup project
add your addins primary output as the source for the installer project:
right click your setup project and add project output
choose your addins primary output and confirm
select your addins primary output as the install and uninstall custom action:
right click your setup project
choose add->custom action
the custom actions tab will appear
right click the install folder and add you projects primary output
do the same for the uninstall folder
(3)
look for the primay output of your setup project in the solution explorer
click on it and look in the properties change its register flag to vspdadonotregister
the installer class will do this for us.
build your installer class and voila all done for you much easier and will call the following code of your addin:
public shared sub registerfunction(byval t as type)
and
public shared sub unregisterfunction(byval t as type)
hope this is helpful.
cheers
tom mulder
in this world i am nobody...
and nobody is perfect ;) !!!
---------
solidworks office 2008 sp4.0
dell precision pws390
nvidia quadro fx 3450/4000 sdi
quick |
|