Groups | Blog | Home
all groups > visual studio .net general > october 2007 >

visual studio .net general : Installer for Windows Service fails on Vista


Gary McGill
10/23/2007 5:23:19 PM
I have a Windows Service written in C# using Visual Studio 2003. I have an
installer project for it, which I again created using Visual Studio 2003.

It all works fine on Windows XP, but I can't get the service installed on
Vista. It gets 90% of the way through the progress dialog, and then just
stops (forever). There are no dialogs, and no event logs or even log files
that let me know what's going wrong. I tried turning off UAC but that didn't
seem to make any difference.

I've virtually no experience of using Vista let alone programming for it, so
I may be missing something obvious.

I guess the first question I should ask is: is it even possible to build an
installer for a Windows Service using Visual Studio 2003 that will actually
work on Vista?

aTdHvAaNnKcSe
Gary

Phil Wilson
10/26/2007 8:12:49 AM
This type of custom action fails on Vista because they run with
impersonation of the installing user but as as a limited user. Visual Studio
doesn't expose the bit you need to set in the custom actions, the
msidbCustomActionTypeNoImpersonate bit. You'd have to open the MSI file with
Orca, find your custom action in the CustomAction table and change it from
(probably) 1024 to 1024+that bit value. I suspect that people have automated
this with code but I can't find it.

It should work ok if you use a setup.exe to launch it (you could use the one
from VS 2005 if you build a setup project of the same name and use
Prerequisites to create a bootstrapper setup.exe). I believe setup.exe will
ask for elevation and then run as elevated administrator, then launch the
MSI file which will also run as elevated administrator.
--
Phil Wilson
[Microsoft MVP-Windows Installer]

[quoted text, click to view]

Gary McGill
10/31/2007 12:00:00 AM
Thanks Phil. I'll try the MSI hack.

[quoted text, click to view]

Gary McGill
11/1/2007 4:27:41 PM
Phil,

I tried using Orca to edit the MSI. I've never used (or heard of) Orca
before, and I really have no idea what it was that I was editing, but from
what I could gather after a long trawl on the net, I decided that the
numbers in the "Type" column were the ones I should change, and that I
should change only the ones that were already >= 1024.

There were 4 numbers in Custom Actions that were > 1024 and I added 2048 to
them all. See http://senduit.com/448a57 for a screenshot of what my Custom
Actions table looked like prior to the changes. (Expires in 1 week).

Anyway, I tried that on the Vista machine, and this time there was a slight
difference in that it gave me a security prompt it didn't do before.
However, it then ran to the same point that it did before, and stalled just
like before. (If it helps, the progress bar went all the way to the end,
then started again from the beginning and got nearly to the end, then
backtracked a little bit and stopped; what a great progress bar that is!).
Because it just hangs, I don't know what's up. I can't find any logging.

Note that I was able to install (and start) the service (using both the
modified and the un-modified MSI) on another Vista machine that has
different policy settings (i.e. where you don't need to jump through hoops
to install stuff). So, there is a working installer hiding in there.

Any ideas on what I should try next?

Thanks,
Gary

[quoted text, click to view]

AddThis Social Bookmark Button