More Group Sites
Education Books
School Rankings
Jobless Net
Better Home
Enviro++
更好教育论坛
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Share
Options
View
Go to last post Go to first unread
hong  
#1 Posted : Sunday, 9 March 2014 9:39:48 AM(UTC)
hong

Rank: Administration

Reputation:

Groups: AcademicCoachingSchool, admin, Administration, BookSeller, CatholicSchool, CoachingAdult, CoachingProfessional, CoachingSports, ExtraCurriculumCoaching, IndependentSchool, Moderator, MusicTeacher, PrivateSchool, PublicSchool, SelectiveSchool, tutor
Joined: 23/11/2008(UTC)
Posts: 523

Use MSI custom installer in Visual Studio

RunInstallerAttribute
In the custom MSI installer, need to set RunInstallerAttribute.
[RunInstallerAttribute(true)]
This attribute specifies whether the Visual Studio Custom Action Installer or the Installutil.exe (Installer Tool) should be invoked when the assembly is installed.

Custom installer - event handling or override
There are two ways to use the custom installer.
1. override
// Override the 'OnAfterInstall' method.
protected override void OnAfterInstall(IDictionary savedState)
{
base.OnAfterInstall(savedState);
// Add steps to be done after the installation is over.
Console.WriteLine("OnAfterInstall method of MyInstaller called");
}

2. event handler - Occurs after the Install methods of all the installers in the Installers property have run.
this.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.GenetecInstaller_AfterInstall);


If the AfterInstall event is not fired in the custom installer, check whether a custom action hasn't been added. If the primary output of the assembly has been added to custom action, it should call the event handlers such as BeforeInstall and AfterInstall. This should be all that is required to fire the BeforeInstall and AfterInstall events.


Customisation: launch application via a javascript
How can I customize an MSI in the Visual Studio setup/deployment project?
http://blogs.msdn.com/b/...e/2006/08/12/696833.aspx
cscript.exe "$(ProjectDir)EnableLaunchApplication.js" "$(BuiltOutputPath)"

Get Target Directory in MSI setup project
Windows installer would in this case dictate the BaseDirectory (for example, C:\Windows\System32) and not the path of the assembly you are installing. Like Rocky Lohtka said, “its about where it is called and not where it is defined!”

To get the target directory property value in your custom action, you can forward it manually by selecting your custom action output in the custom action view and putting something like:

/TargetDir="[TARGETDIR]\"
as the value for the CustomActionData property.
Note the addition of the backslash.

You should then be able to access it by:
string targetDir = Context.Parameters[ "TargetDir" ];

Reference:
Visual Studio Install Project: Get Target Directory
http://stackoverflow.com...ect-get-target-directory

Using custom configuration section and custom actions to update and deploy App.config for different regions dynamically with Msi package
http://www.codeproject.c...n-section-and-actions-to

Edited by user Sunday, 9 March 2014 9:45:26 AM(UTC)  | Reason: Not specified

Sponsor
Rss Feed  Atom Feed
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.