By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

Deployment project - conditional custom action

P: n/a
I have a deployment project that I'm setting up. I need to perform a
different custom action based on whether this is a first time install or an
update. Does anyone have any idea if it's possible to set the Condition
property of a custom action to determine if the currently running install is
upgrading a previous installation and if so how? I'm also open to other
methods of acheiving this functionality.
Apr 28 '07 #1
Share this Question
Share on Google+
13 Replies


P: n/a
How are you deploying it? ClickOnce? Or WindowsInstaller?

What is the custom action that you need to perform?

Robin S.
----------------
"Matt F" <mf****************@nospam.nospamwrote in message
news:%2*****************@TK2MSFTNGP03.phx.gbl...
>I have a deployment project that I'm setting up. I need to perform a
different custom action based on whether this is a first time install or
an update. Does anyone have any idea if it's possible to set the
Condition property of a custom action to determine if the currently
running install is upgrading a previous installation and if so how? I'm
also open to other methods of acheiving this functionality.

Apr 30 '07 #2

P: n/a
Hi Matt,

Based on my understanding, you'd like to add a condition based on whether
the MSI package is installed for the first time or not, on a custom action.
If I'm off base, please feel free to let me know.

The Installed property is initialized if the product is already installed
on the system. If you want to run a custom action only when the product is
first installed, you can use Not Installed as a condition.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Apr 30 '07 #3

P: n/a
I've released using a different method of determing what I need to know but
I will need to get this resolved for future releases.

This s a windows installer project.

In the "commit" custom action, I need to call my application with a
different command line parameter based on whether it's a new install or an
upgrade to a previous install. The function of the command line parameter
will determine whether to upgrade data from a previous installation or set
up the base sample data for the application. Yes, it's possible for me to
just check and see if the data is there, but there are firewall issues that
make that a less than optimal solution.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:r8******************************@comcast.com. ..
How are you deploying it? ClickOnce? Or WindowsInstaller?

What is the custom action that you need to perform?

Robin S.
----------------
"Matt F" <mf****************@nospam.nospamwrote in message
news:%2*****************@TK2MSFTNGP03.phx.gbl...
>>I have a deployment project that I'm setting up. I need to perform a
different custom action based on whether this is a first time install or
an update. Does anyone have any idea if it's possible to set the
Condition property of a custom action to determine if the currently
running install is upgrading a previous installation and if so how? I'm
also open to other methods of acheiving this functionality.


Apr 30 '07 #4

P: n/a
Linda,

I assume your talking about setting the condition property of the custom
action. The property appears to accept a text value --- is there an article
or some other information showing the syntax for how to use this property?

Also, I'm making a further assumption that the Installed property that your
speaking of is a property of the windows installer itself. If this is the
case and I'm testing the property in the commit cutom action, would it not
already be returning a value of true?
"Linda Liu [MSFT]" <v-****@online.microsoft.comwrote in message
news:WT**************@TK2MSFTNGHUB02.phx.gbl...
Hi Matt,

Based on my understanding, you'd like to add a condition based on whether
the MSI package is installed for the first time or not, on a custom
action.
If I'm off base, please feel free to let me know.

The Installed property is initialized if the product is already installed
on the system. If you want to run a custom action only when the product is
first installed, you can use Not Installed as a condition.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Apr 30 '07 #5

P: n/a
I'm glad you figured out a way to get it to work. I'm using ClickOnce
deployment, and I don't know that there's a way to tell.

Robin S.
---------------------------
"Matt F" <mf****************@nospam.nospamwrote in message
news:e7**************@TK2MSFTNGP06.phx.gbl...
I've released using a different method of determing what I need to know
but I will need to get this resolved for future releases.

This s a windows installer project.

In the "commit" custom action, I need to call my application with a
different command line parameter based on whether it's a new install or
an upgrade to a previous install. The function of the command line
parameter will determine whether to upgrade data from a previous
installation or set up the base sample data for the application. Yes,
it's possible for me to just check and see if the data is there, but
there are firewall issues that make that a less than optimal solution.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:r8******************************@comcast.com. ..
>How are you deploying it? ClickOnce? Or WindowsInstaller?

What is the custom action that you need to perform?

Robin S.
----------------
"Matt F" <mf****************@nospam.nospamwrote in message
news:%2*****************@TK2MSFTNGP03.phx.gbl.. .
>>>I have a deployment project that I'm setting up. I need to perform a
different custom action based on whether this is a first time install or
an update. Does anyone have any idea if it's possible to set the
Condition property of a custom action to determine if the currently
running install is upgrading a previous installation and if so how? I'm
also open to other methods of acheiving this functionality.



May 1 '07 #6

P: n/a
Hi Matt,

Thank you for your prompt response.

The 'Installed' property is a standard Windows Installer property, which
returns the installation date time (in string) if the product has already
been installed on the machine.

There are only two major categories of custom actions. The category of a
custom action is indicated by a number in the type column of the
CustomAction table (You should be finding this table in Orca). The two
categories are Deferred and Immediate.

How you create the custom action in your MSI package? If you're using VS to
create it, it should be Deferred.

For Immediate custom action, we can specify the condition of the custom
action as Not Installed or Installed="" for the condition of new
installation, and Installed or Installed<>"" for upgrade installation.

My test shows that the Installed property always returns an empty string
when the deferred custom action is launched. In this case, you may add a
custom property and set the value of the Installed property to this
property in an Immediate custom action and then use this property as the
condition on your deferred custom action.

For more information on custom action, you may read the following article:

Custom Action Tutorial Part I C Custom Action Types and Sequences
http://bonemanblog.blogspot.com/2005...-part-i-custom
..html

Hope this helps.
Sincerely,
Linda Liu
Microsoft Online Community Support

May 3 '07 #7

P: n/a
Hi Matt,

Sorry that I made a mistake in my previous reply.

I was trying to get the value of the Installed property in a VB script file
and create a commit custom action to run this VB script file in VS. The
content of the VB script file is like the following:
msgbox "Installed = " & Property("Installed")

When I install the MSI package for the first time, the message box pops up
showing an empty text. When I install the MSI package for the second time,
the message box pops up still showing an empty text.

I have read more about custom action later and realized that when a
deferred custom action is encountered, its condition is evaluated. If the
condition is met, the deferred custom action is written to the installation
script, and will be executed later; otherwise, it is not added to the
installation script.

My previous test shows that when the deferrd custom action is executed, the
value of the Installed property is an empty string. But my later test shows
when the deferred custom action is encountered, the Installed property
returns the correct value.

So use Installed="" or Not Installed as the condition of your commit custom
action for the first installation, and Installed<>"" or Installed as the
condition of your commit custom action for the upgrade.

If you're using VS to create the setup project, you coud specify the above
condition in the custom action's Condition property entry in the Properties
window.

Hope this helps.
If you have anything unclear, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

May 4 '07 #8

P: n/a
Linda,

I essentially have 2 custom actions set up -- each with a different action
that is performed, one for Installed and one for Not Installed. The problem
is if I run the installer against a previous version, Installed is not
evaluating to true.

I suspect what is actually happening is the setup determines there is a
previous version, uninstalls it, then procedes with installing as if for the
first time. If correct, that means the value of Installed is evaluated
after the previous version is uninstalled, but before the new version begins
installing.

I'm still stuck in the same place with this one.

"Linda Liu [MSFT]" <v-****@online.microsoft.comwrote in message
news:xc**************@TK2MSFTNGHUB02.phx.gbl...
Hi Matt,

Sorry that I made a mistake in my previous reply.

I was trying to get the value of the Installed property in a VB script
file
and create a commit custom action to run this VB script file in VS. The
content of the VB script file is like the following:
msgbox "Installed = " & Property("Installed")

When I install the MSI package for the first time, the message box pops up
showing an empty text. When I install the MSI package for the second time,
the message box pops up still showing an empty text.

I have read more about custom action later and realized that when a
deferred custom action is encountered, its condition is evaluated. If the
condition is met, the deferred custom action is written to the
installation
script, and will be executed later; otherwise, it is not added to the
installation script.

My previous test shows that when the deferrd custom action is executed,
the
value of the Installed property is an empty string. But my later test
shows
when the deferred custom action is encountered, the Installed property
returns the correct value.

So use Installed="" or Not Installed as the condition of your commit
custom
action for the first installation, and Installed<>"" or Installed as the
condition of your commit custom action for the upgrade.

If you're using VS to create the setup project, you coud specify the above
condition in the custom action's Condition property entry in the
Properties
window.

Hope this helps.
If you have anything unclear, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

May 19 '07 #9

P: n/a
Hi Matt,

Thank you for your feedback.

Based on my understanding, you have 2 custom actions in the MSI package.
When you launch the MSI package, you'd like one custom action to be
executed if the product is not installed, and the other custom action to be
executed if the product has been installed.

I performed a test on this but didn't reproduce the problem. I create 2
custom actions and specify 'Not Installed' as the condition of the first
custom action and 'Installed' as the condition of the second one. Build the
project and launch the MSI package.

When the MSI package is installed for the first time, the first custom
action is executed. When the MSI package is installed for the second time,
the second custom action is executed.
I suspect what is actually happening is the setup determines there is a
previous version, uninstalls it, then procedes with installing as if for
the
first time.

No, it shouldn't be the case. When the an MSI package is installed for a
second time, the previous installation won't be uninstalled, and the MSI
package will just replace the previous installed files.

In addition, When the custom action is met, the real installation, in this
case replacing the previous installed files, has not started and the value
of the 'Installed' property is true if the previous installation exists.

Sincerely,
Linda Liu
Microsoft Online Community Support

May 22 '07 #10

P: n/a
Follow these steps to reproduce:

1: create an install with 2 custom actions
2: install the application - the custom action associated with Not Installed
is run
3: increment the version number in the installer (in my case, from 2.8 to
2.81)
3a: when asked to update the guid, say yes
4: rebuild the install
5: run the install on the same machine the app was installed to in step 2
6 - the custom action associated with Not Installed is run - this is the
problem - the one for Installed should run instead

"Linda Liu [MSFT]" <v-****@online.microsoft.comwrote in message
news:ch**************@TK2MSFTNGHUB02.phx.gbl...
Hi Matt,

Thank you for your feedback.

Based on my understanding, you have 2 custom actions in the MSI package.
When you launch the MSI package, you'd like one custom action to be
executed if the product is not installed, and the other custom action to
be
executed if the product has been installed.

I performed a test on this but didn't reproduce the problem. I create 2
custom actions and specify 'Not Installed' as the condition of the first
custom action and 'Installed' as the condition of the second one. Build
the
project and launch the MSI package.

When the MSI package is installed for the first time, the first custom
action is executed. When the MSI package is installed for the second time,
the second custom action is executed.
>I suspect what is actually happening is the setup determines there is a
previous version, uninstalls it, then procedes with installing as if for
the
first time.

No, it shouldn't be the case. When the an MSI package is installed for a
second time, the previous installation won't be uninstalled, and the MSI
package will just replace the previous installed files.

In addition, When the custom action is met, the real installation, in this
case replacing the previous installed files, has not started and the value
of the 'Installed' property is true if the previous installation exists.

Sincerely,
Linda Liu
Microsoft Online Community Support

May 22 '07 #11

P: n/a
Hi Matt,

Thank you for your prompt response.

I performed a test based on your steps and did see that the Installed
property returns false when the upgrade MSI package is installed.

In my previous test, I used the same MSI package, so the Installed property
returned true when the same MSI package was installed for the second time.

In your scenario, you should use the PREVIOUSVERSIONSINSTALLED property,
which is a public property generated by VS.

For the custom action you want to execute when you install the MSI package
for the first time, use PREVIOUSVERSIONSINSTALLED as the condition. For
the custom action you'd like to execute when upgrading, use Not
PREVIOUSVERSIONSINSTALLED as the condition.

Please try my suggestion and let me know the result.

Sincerely,
Linda Liu
Microsoft Online Community Support

May 22 '07 #12

P: n/a
Linda,

Thanks for getting back to me on this. Using the PREVIOUSVERSIONINSTALLED
condition seems to handle what I need beautifully. I still have some
internal testing to do, but I'm not expecting any of those tests to fail.
Thank you!!!

As long as we're in this thread, are the available properties documented
someplace? I'd be curious to see what else is available.

"Linda Liu [MSFT]" <v-****@online.microsoft.comwrote in message
news:zo**************@TK2MSFTNGHUB02.phx.gbl...
Hi Matt,

Thank you for your prompt response.

I performed a test based on your steps and did see that the Installed
property returns false when the upgrade MSI package is installed.

In my previous test, I used the same MSI package, so the Installed
property
returned true when the same MSI package was installed for the second time.

In your scenario, you should use the PREVIOUSVERSIONSINSTALLED property,
which is a public property generated by VS.

For the custom action you want to execute when you install the MSI package
for the first time, use PREVIOUSVERSIONSINSTALLED as the condition. For
the custom action you'd like to execute when upgrading, use Not
PREVIOUSVERSIONSINSTALLED as the condition.

Please try my suggestion and let me know the result.

Sincerely,
Linda Liu
Microsoft Online Community Support

May 22 '07 #13

P: n/a
Hi Matt,

The PREVIOUSVERSIONINSTALLED is not a standard MSI property. It's generated
by Visual Studio.

If you open the MSI package using Orca, and open the Upgrade table, you
should see PREVIOUSVERSIONINSTALLED in the ActionProperty column.

For more information on MSI property, you may refer to the following MSDN
document:

'Property Reference'
http://msdn2.microsoft.com/en-us/library/aa370905.aspx

Hope this helps.
Sincerely,
Linda Liu
Microsoft Online Community Support

May 23 '07 #14

This discussion thread is closed

Replies have been disabled for this discussion.