[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.setup

Question About Running An EXE Immediately After My Installation

joey.powell

8/11/2008 1:15:00 PM

Hello guys. I have written a windows forms app in VS2008 (.net 2.0)
that is, itself, basically an "apply" and "remove" utility for some
added functionality to a pre-existing application.

So it works like this, users launch the app and then are presented
with info stating (1) whether or not the added functionality is
applied and then (2) whether or not they want to apply or remove
it...depending, of course, on the current state.

Now, the app already has command line functionality built in for being
able to silently apply and remove. For example one could silently
apply by issuing the following command in a batch file or command
script...

myapp.exe /a

.... And so after the installation for my app has taken place, I simply
need to be able to fire off the above command, so that the initial
state ends up as being both installed AND "applied."

I have already been reading a lot about how to do this. Thus far I
feel the best option is to create a Custom Action in the Commit phase
of my installation and fire off the silent apply at that point. But
each time I try to run this, I see it run and appear to work but then
end with the following error...

There is a problem with this Windows Installer package. A program run
as part of the setup did not finish as expected. Contact your support
personnel or package vendor.

Do you guys have any idea what would be causing this? What can I do to
make it work?

Maybe there is better way to accomplish this?...all I really need to
do is fire the EXE at the end of the install.

Thanks in advance for your help.
3 Answers

hcurrie

8/11/2008 2:49:00 PM

0


<joey.powell@topscene.com> wrote in message
news:18d1e38a-7e48-4888-8ddf-25d69cc9cfe5@f36g2000hsa.googlegroups.com...
> Hello guys. I have written a windows forms app in VS2008 (.net 2.0)
> that is, itself, basically an "apply" and "remove" utility for some
> added functionality to a pre-existing application.
>
> So it works like this, users launch the app and then are presented
> with info stating (1) whether or not the added functionality is
> applied and then (2) whether or not they want to apply or remove
> it...depending, of course, on the current state.
>
> Now, the app already has command line functionality built in for being
> able to silently apply and remove. For example one could silently
> apply by issuing the following command in a batch file or command
> script...
>
> myapp.exe /a
>
> ... And so after the installation for my app has taken place, I simply
> need to be able to fire off the above command, so that the initial
> state ends up as being both installed AND "applied."
>
I'm not an expert by any means but I have been looking at similar things
myself recently.
I think that the error you are getting may be because you are using the
Install event, but not the commit event. The help is very unclear on this,
but if you look carefully at the example they give, it says to use both
events.

In this case though, you might find it easier to use a Post Build event on
your setup project. If you do it this way I don't think you will need an
installer class,
and you can just enter the command directly, as it would be used from a
command prompt.

I have run into problems using an installer class because the code runs
under the SYSTEM account rather than the logged in user, so you may run into
access right issues. See my post in the VB ng:
news:lvCdnUUR-bGwjwXVnZ2dnUVZ8q7inZ2d@posted.plusnet




joey.powell

8/11/2008 3:21:00 PM

0

On Aug 11, 9:49 am, "Phil" <N/A> wrote:
> <joey.pow...@topscene.com> wrote in message
>
> news:18d1e38a-7e48-4888-8ddf-25d69cc9cfe5@f36g2000hsa.googlegroups.com...
>
> > Hello guys. I have written a windows forms app in VS2008 (.net 2.0)
> > that is, itself, basically an "apply" and "remove" utility for some
> > added functionality to a pre-existing application.
>
> > So it works like this, users launch the app and then are presented
> > with info stating (1) whether or not the added functionality is
> > applied and then (2) whether or not they want to apply or remove
> > it...depending, of course, on the current state.
>
> > Now, the app already has command line functionality built in for being
> > able to silently apply and remove. For example one could silently
> > apply by issuing the following command in a batch file or command
> > script...
>
> > myapp.exe /a
>
> > ... And so after the installation for my app has taken place, I simply
> > need to be able to fire off the above command, so that the initial
> > state ends up as being both installed AND "applied."
>
> I'm not an expert by any means but I have been looking at similar things
> myself recently.
> I think that the error you are getting may be because you are using the
> Install event, but not the commit event. The help is very unclear on this,
> but if you look carefully at the example they give, it says to use both
> events.
>
> In this case though, you might find it easier to use a Post Build event on
> your setup project. If you do it this way I don't think you will need an
> installer class,
> and you can just enter the command directly, as it would be used from a
> command prompt.
>
> I have run into problems using an installer class because the code runs
> under the SYSTEM account rather than the logged in user, so you may run into
> access right issues. See my post in the VB ng:news:lvCdnUUR-bGwjwXVnZ2dnUVZ8q7inZ2d@posted.plusnet

I was already doing this in the "Commit" phase. And I was not using an
installer class...I mean I was using a custom action but I had the
"Installer Class" property set to "False". Anyways I found the
problem, for the silent apply and removes, I still had code to exit
like this..."Environment.Exit(-1100)". Windows installer was picking
up the negative exit code and interpreting it as an error (as it
probably should). Anyways I changed it to "Environment.Exit(0)", and
now it works.

Now I have to find out how to run "myapp.exe /r" to remove in the case
that the user uninstalls the tool without first removing the added
functionality. I have successfully used the commit phase to trigger
the "apply" immediately after installation, but I can find no
counterpart to use for "removal" just before uninstallation.
Unfortunately the uninstall phase fires AFTER the uninstall and not
before.

Thanks.

Phil Wilson

8/11/2008 5:15:00 PM

0

Uninstall custom actions generated by Visual Studio setup projects do not
run after the uninstall. They run before anything significant is removed
from the system and should work fine.

--
Phil Wilson
Definitive Guide to Windows Installer
http://www.apress.com/book/view/...


<joey.powell@topscene.com> wrote in message
news:0b41b4a3-28fd-4aa3-a699-20123c8c75c4@t54g2000hsg.googlegroups.com...
On Aug 11, 9:49 am, "Phil" <N/A> wrote:
> <joey.pow...@topscene.com> wrote in message
>
> news:18d1e38a-7e48-4888-8ddf-25d69cc9cfe5@f36g2000hsa.googlegroups.com...
>
> > Hello guys. I have written a windows forms app in VS2008 (.net 2.0)
> > that is, itself, basically an "apply" and "remove" utility for some
> > added functionality to a pre-existing application.
>
> > So it works like this, users launch the app and then are presented
> > with info stating (1) whether or not the added functionality is
> > applied and then (2) whether or not they want to apply or remove
> > it...depending, of course, on the current state.
>
> > Now, the app already has command line functionality built in for being
> > able to silently apply and remove. For example one could silently
> > apply by issuing the following command in a batch file or command
> > script...
>
> > myapp.exe /a
>
> > ... And so after the installation for my app has taken place, I simply
> > need to be able to fire off the above command, so that the initial
> > state ends up as being both installed AND "applied."
>
> I'm not an expert by any means but I have been looking at similar things
> myself recently.
> I think that the error you are getting may be because you are using the
> Install event, but not the commit event. The help is very unclear on this,
> but if you look carefully at the example they give, it says to use both
> events.
>
> In this case though, you might find it easier to use a Post Build event on
> your setup project. If you do it this way I don't think you will need an
> installer class,
> and you can just enter the command directly, as it would be used from a
> command prompt.
>
> I have run into problems using an installer class because the code runs
> under the SYSTEM account rather than the logged in user, so you may run
> into
> access right issues. See my post in the VB
> ng:news:lvCdnUUR-bGwjwXVnZ2dnUVZ8q7inZ2d@posted.plusnet

I was already doing this in the "Commit" phase. And I was not using an
installer class...I mean I was using a custom action but I had the
"Installer Class" property set to "False". Anyways I found the
problem, for the silent apply and removes, I still had code to exit
like this..."Environment.Exit(-1100)". Windows installer was picking
up the negative exit code and interpreting it as an error (as it
probably should). Anyways I changed it to "Environment.Exit(0)", and
now it works.

Now I have to find out how to run "myapp.exe /r" to remove in the case
that the user uninstalls the tool without first removing the added
functionality. I have successfully used the commit phase to trigger
the "apply" immediately after installation, but I can find no
counterpart to use for "removal" just before uninstallation.
Unfortunately the uninstall phase fires AFTER the uninstall and not
before.

Thanks.