473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Deployment project - conditional custom action

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
13 9663
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
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
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Arun Bhalla | last post by:
I'm working with VS.NET 2003 and .NET 1.1 (not SP1) on Windows XP SP1. My application is using the Windows Installer Bootstrap. (I may have also installed a module which detects requirements (.NET...
3
by: Jim Owen | last post by:
Hi All, I'm putting together my first web deployment project using VS2003 and have a few questions someone might be able to help on. First, I need to modify the web.config file based on entries...
7
by: dhussong | last post by:
I have created a Setup and Deployment project in Visual Studio.NET 2003. After my installation has completed running I'd like to launch the EXE that I just installed. I've found how to launch the...
3
by: KennethLundin | last post by:
Hi, i'm developing a solution in VS9/CSharp. Now I'm constructing a deployment project for my appliation (thick, database driven, winforms, standard, good old type of application). During...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.