.NET Forum / Visual Studio.NET / Setup / March 2007
Custom Actions during setup
|
|
Thread rating:  |
Matt F - 19 Jan 2007 17:09 GMT I've created a setup/deployment package. I need to call my executable with a command line param at the end of the install (used to set up default databases, connection strings etc.) I've set up a custom action that points to the "Primary Output", but it's not firing. Any pointers would be greatly appreciated.
Phil Wilson - 21 Jan 2007 19:14 GMT Try including the actual exe instead of the Primary Output. Also, if this is an install custom action it's highly unlikely that it's not being called. It could be immediately failing if it won't load (because it needs dependencies that aren't installed yet, like GAC assemblies).
 Signature Phil Wilson [Microsoft MVP-Windows Installer]
> I've created a setup/deployment package. I need to call my executable > with a command line param at the end of the install (used to set up > default databases, connection strings etc.) I've set up a custom action > that points to the "Primary Output", but it's not firing. Any pointers > would be greatly appreciated. Steven Cheng[MSFT] - 22 Jan 2007 03:33 GMT Thanks for Phil's input.
Hi Matt,
Is the "executable" you mentioned a custom exe program you used(as custom action exe) to do the database intialization/configuration? if so, in the custom action view(of setup project), you can select the certain "exe" in the Custom Actions list. Then, in the "Properties" window, you will find the following properties:
** (Name) **Arguments **Condition **CustomActionData ......
And the "Arguments" property is used supply any commandline arguments for the exe program.
You can also add a custom action class which use Process. Start to launch the separate exe program. Or you can even directly embed your database(or other intialization/configuration code in the custom action code). Here are some walk through articles which may be helpful:
#Walkthrough: Creating a Custom Action http://msdn2.microsoft.com/en-us/library/d9k65z2d(VS.80).aspx
#Walkthrough: Using a Custom Action to Create a Database at Installation http://msdn2.microsoft.com/en-gb/library/49b92ztk(VS.80).aspx
Please fee free to post here is you have met any other problem.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Matt F - 23 Jan 2007 08:52 GMT Thanks for all of your help guys... I think I'm getting close to being complete.
I do need to find a way to launch my newly installed application at the end of the setup. It is important that the msi is closed at this point however. The reason being is I include the installer for SQLExpress in my setup package, and then in my application, determine if the proper instance of SQL express is already on the target machine --- if not, the command line is built and the install for sql express is launched. The reason the msi that installs my application must be closed is 2 msi packages cannot be run simultaneously.
Any help would be greatly appreciated.
> Thanks for Phil's input. > [quoted text clipped - 57 lines] > This posting is provided "AS IS" with no warranties, and confers no > rights. Steven Cheng[MSFT] - 24 Jan 2007 01:50 GMT Hi Matt,
As you said you're manually launch the SQLExpress package if necessary,correct? However, based on your previous threads ,you are using the VS 2005 setup project's bootstrapper/prerequisites feature to do the SQL Express deployment and this should occur before your own application start installation. Also, for those SQL Express instance detect, I've posted information on the conditional install detection for bootstrapper package in the previous thread, have you had a look at that or do you have any other concerns that make you unable to use that approach?
Anyway, when using bootstrapper package to deploy prerequisites, after the prerequisites be installed, the setup process of it should end and then your main application's installation start. If you want to any further configuration on the created SQL Express instance, you can use a custom Action in your main application's setup program. This strength of this is that those initalization code logic does not need to be added into your main application's code logic.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Matt F - 25 Jan 2007 18:57 GMT Steven,
I've moved away from teh approach of using a bootstrapper for the install of SQLExpress and have included the logic in my application code to handle the install. The logic was modeled after information in the article here: http://msdn2.microsoft.com/en-us/library/bb264562.aspx
The reason for making this change is the SQLExpress pre-requisite would be dependent on a specific instance of SQLExpress, which obviously almost no one would have, so I prefer to include the install file in the download of hte application. Unfortunately, if I were to include the setup for SQLExpress in the download file, I would also have to include the setups for other pre-requisites as the "location for setup prerequisites" setting applies to all -- meaning I would have to include the dotnetframework and installer 3.1 packages when many people will not need them.
I have coded a command line parameter in my application that will invoke code similar to what is mentioned in the article that checks for the instance of SQLExpress and then installs if needed. Unfortunately, with the limitation of not being able to run 2 msi packages simultaneously, using a custom action to run the command line parameter causes the setup for sqlexpress to fail.
For prior versions, I had been using InstallShield to install my product, which includes the capability of launching the installed application at the end of the install. That is what I would like to do is have the install launch my application with a command line parameter, and then exit the msi installer that I'm creating. This would result in the custom logic in my applicationg that installs SQLExpress to work without failing.
I'm sorry if the explanation went a little long - I wanted to make sure what I'm looking for was relatively clear.
> Hi Matt, > [quoted text clipped - 23 lines] > This posting is provided "AS IS" with no warranties, and confers no > rights. Steven Cheng[MSFT] - 29 Jan 2007 13:33 GMT Hello Matt,
Sorry for the late response. I'm just back from an urgent issue. For the bootstrapper's "install location", it does be a global setting for all the packages you'll included in the setup program(to act as the prerequisites). However, it still depend on each individual bootstrapper package. In the bootstrapper package's package.xml file, you'll found the "HomeSite" attribute inside the "PackageFile" element. This "HomeSite" attribute indicate the remote url to download the package file at runtime(if you choose to use web location in the setup project for the prerequisites). e.g. Here is the default value in SQLExpress's bootstrapper package.xml:
============= <PackageFiles CopyAllPackageFiles="false"> <PackageFile Name="sqlexpr32.exe" HomeSite="SqlExprExe" ................. =============
You can temporarily remove this attribute when you want to build your setup program which always copy the sqlexpr32.exe locally with your main setup program(no matter what value you've choosed for prerequisites's "install location" in setup project's properties).
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Christian Cheney - 01 Mar 2007 22:16 GMT I want to pass the program directory of the installed app to my custom action app. The actual argument string would look like the following.
"C:\Program Files\MyApp" Arg2 +a3 +a4
However, when I put quotes around [TARGETDIR]...
"[TARGETDIR]" Arg2 +a3 +a4
...it doesn't quite work. The custom action app thinks it's all one argument (strangely... with a quote in the middle).
C:\Program Files\MyApp" Arg2 +a3 +a4
If I leave the quotes out, my app thinks that C:\Program & Files\MyApp are separate arguments.
Please help. Thanks.
EggHeadCafe.com - .NET Developer Portal of Choice http://www.eggheadcafe.com
Trent - 05 Mar 2007 07:39 GMT Christian, I was having the same problem and I just figured out a solution. To get that to work as one input parameter, you have to put the argument like this.
"[TARGETDIR]\" arg2 arg3
Note the backslash before the second quote.
Hope this helps.
Trent
> I want to pass the program directory of the installed app to my custom action app. The actual argument string would look like the following. > [quoted text clipped - 14 lines] > EggHeadCafe.com - .NET Developer Portal of Choice > http://www.eggheadcafe.com
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|