Visual Studio installation project: run CustomActions / process as the current user, not the system account

I am using the installation project in visual studio 2010 for the C # outlook add-in (Office 2010/2013) and another standalone tool. During installation, I kill all instances of Outlook, after which I want to restart the instance of Outlook.

In my addin project, I added installerclass and added InstallEventHandler (AfterInstallEventHandler), where I execute

Process.Start("Outlook");

While the same command simply opens Outlook in another compiled class, in the context of opening the installer, it opens in the profile creation wizard.

I also tried to run the mentioned working compiled exe as a custom action after commit, but the same problem occurs.

Any solution or explanation would be appreciated.

+5
source share
2 answers

DECISION:

Installation is performed in the SYSTEM account. Therefore, the created process also runs in the specified account, and not as the user currently logged in.

I created an additional project (InstallHelper) that includes

Process.Start("Outlook");

I added InstallHelper as CustomAction on Commit in my installation project and changed the InstallerClass to False in the CustomAction properties. Then I copied the WiRunSql.vbs file to the project folder and added PostBuildEvent to the installation project:

@echo off
cscript //nologo "$(ProjectDir)WiRunSql.vbs" "$(BuiltOutputPath)" "UPDATE CustomAction SET Type=1554 WHERE Type=3602"

3602:

  • 0x800 (msidbCustomActionTypeNoImpersonate)
  • 0x400 (msidbCustomActionTypeInScript)
  • 0x200 (msidbCustomActionTypeCommit)
  • 0x12 (Custom Action Type 18: exe)

1554:

  • 0x400 (msidbCustomActionTypeInScript)
  • 0x200 (msidbCustomActionTypeCommit)
  • 0x12 (Custom Action Type 18: exe)

: msdn: Custom Action In- Script

msidbCustomActionTypeNoImpersonate (0x00000800), InstallHelper , SYSTEM.

msi orca ( , ).

+4

( , ):

WiRunSql.vbs : ( argument2-update script)

( PostBuildevent

@echo off
cscript //nologo "$(ProjectDir)WiRunSql.vbs" "$(BuiltOuputPath)"

)

Dim filename, installer, database
filename = WScript.Arguments(0)
Set installer = CreateObject("WindowsInstaller.Installer")
Set database = installer.OpenDatabase(filename, 1)
sql = "UPDATE `CustomAction` SET `Type`= 1554 WHERE `Type`= 3602"
Set view = database.OpenView(sql)
view.Execute
view.Close
database.Commit

script promt :

cscript "C:\Projects\YourProject\WiRunSql.vbs" "C:\Projects\YourProject\Debug\Setup.msi"

script

, orca https://support.microsoft.com/en-us/kb/255905

: http://www.codeproject.com/Articles/383481/Editing-an-MSI-Database http://integr8consulting.blogspot.ru/2012/04/microsoft-installer-custom-actions-user.html https://github.com/facebookarchive/ie-toolbar/blob/master/Common/Install/msi/FBIE-MSI/scripts/msipostbuild.vbs

+2

All Articles