joey.powell
8/11/2008 3:21:00 PM
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.