Deployment.
-
Hi I was wondering if anybody knows how to create a MSI project(Setup and Deployment project). I am using Visual studio to do this but can't figure out how to pass parameters entered on screen to my registry. Any help would be appreaciated
Stephen Lintott Bsc IT (RAU)
-
Hi I was wondering if anybody knows how to create a MSI project(Setup and Deployment project). I am using Visual studio to do this but can't figure out how to pass parameters entered on screen to my registry. Any help would be appreaciated
Stephen Lintott Bsc IT (RAU)
Hi Stephen, You will need to add an installer class to one of the assemblies that you are installing. Windows installer calls into this during the running of the msi. You can put .net code in this class to do pretty much whatever you need to do. This link should get you going on the right track. http://msdn.microsoft.com/en-us/library/system.configuration.install.installer.aspx[^]
-
Hi Stephen, You will need to add an installer class to one of the assemblies that you are installing. Windows installer calls into this during the running of the msi. You can put .net code in this class to do pretty much whatever you need to do. This link should get you going on the right track. http://msdn.microsoft.com/en-us/library/system.configuration.install.installer.aspx[^]
OK lets say I've got a form that sets regestry values. I must add an installer class to that project and then add that project to the custom actions. Is that right?
Stephen Lintott Bsc IT (RAU)
-
OK lets say I've got a form that sets regestry values. I must add an installer class to that project and then add that project to the custom actions. Is that right?
Stephen Lintott Bsc IT (RAU)
Yes that's along the right lines. Generally your project will output a single assembly (exe / dll). That assembly may have some requirements that need to be created at installation time - in your case, registry entries. So you build an installer class into each assembly, which handles the requirements for that assembly. So your installer class in this case, will read the parameters that are passed to it from the msi (which the user typed into the msi gui). It will then use these parameters when creating the registry entries. The assembly in question needs to be added to the custom actions - this is how the msi knows to look into that assembly and find the installer class and call its methods. The mapping between the msi gui fields and the CustomActionData property of the custom action in the deployment package designer is something like this: /MasterClientID=[MASTERCLIENTID] /LoggingPath=[LOGGINGPATH] /LogMsgsPath=[LOGMSGSPATH] /LogDbConnStr=[LOGDBCONNSTR] The code for retrieving the parameters in the installer is something like this:
public override void Commit(IDictionary savedState)
{
string mstrClientId = Context.Parameters["MasterClientID"];
string loggingPath = Context.Parameters["LoggingPath"];