Introduction
The NSIS not support an automatic distribution for the MFC program . This post solve this problem.
Backgroung
First of all I use Visual Studio 2005 to deploy my MCF application and I use NSIS installer to redistribute it. The SO target are Windows Xp and Vista.
I solve the problem in a very easy way.
I build a ClickOnce setup on my solution, and i use it in silent mode inside the NSIS.
Info: I use the ClickOnce to install all the redistributable file instead vcredist_x86.exe becouse with the vcredist_x86.exe you need other istructions, like register some files.
With my solution after install it the program is ready to use.
The step needed are 2
1 Create the ClickOnce setup and modify it a bit.
2 Add it to NSIS
1 ClickOnce
Create the ClickOnce setup on your solution. Simply I add a new project to my solution I use the Setup Wizard Project inside Other Project Types. I follow the steps needed and I only add the primary output to the output group at step 3 (Figure 1).
I've left all the other page as default. At the end the result solution is like this (Figure 2).
Now I don't need to distribute the the primary output, and I exclude it (Figure 3), Unfortunatly this not avoid the creation of installation dir.
Figure 3
The last step is to delete all the page inside the wizard. Go to the UI editor (Figure 5)I don't install anything else, and I don' need the default location for the app. I haven't find a way to delete this key but a way to change it to an existing one, i choose the root, so to do that i change in the File sistem editor the property of the application folder to c:\ (Figure 4) you can change it with %TEMP% or %APPDATA% or what you want.
and delete all the page (Figure 6) .
2 NSIS
Silent mode:
Now you have the installation ready but the progress bar before the start of the installation still appears. To hide that dialog I use the msiexec comman. For the Installation command :'msiexec /quiet /i MicrosoftMFC8Runtime.msi'.For the unistall command 'msiexec /quiet /x MicrosoftMFC8Runtime.msi'
Adding the command line to NSIS:
The process is very simple. I need to copy the file MicrosoftMFC8Runtime.msi and execute it waiting the installer til the installer finish, after i Delete it.
Section MFCRUNTIMEFor the uninstall section you only need to uninstall the MicrosoftMFC8Runtime like you can do in the Add/Remove program. You can do this with the right GUID of MicrosoftMFC8Runtime.
SetOutPath "$INSTDIR"
File "MicrosoftMFC8Runtime.msi" "Step 1 Install Microsoft MFC8 Runtime"
ExecWait "msiexec /quiet /i MicrosoftMFC8Runtime.msi"
"Step 2 Install Microsoft MFC 8 Runtime"
delete "MicrosoftMFC8Runtime.msi" #Step 3 Install Microsoft MFC 8 Runtime"
SectionEnd
The Guid is the 'ProductCode' In your ClickOnceSetup, is a property value.
In my case I need only this line for unistall it
Section unMFCRUNTIMEWell now compile your NSIS file and try it.
ExecWait "msiexec /quiet /i{843A5D8A-2FD3-4E51-AFBA-A1551D8F41B9}"
SectionEnd
Conclusion
I've try it under few Windows Vista and a lot of Windows Xp without problem.
Have fun.
Let me know if you have any problems regarding this short tutorial.
Kind regards.
Nessun commento:
Posta un commento