VS Setup Project Windows service questions - windows-services

My setup project installs a windows service. Right now this action is in the Install category. Would the commit category be a better location for it?
I've added a custom action to remove the service in the Uninstall category, but when I run the uninstall, the user is prompted to shut down the service. As the user should never really know that the service exists, I'd rather this never pops up, but rather stops the service on its own and simply uninstalls this. I can't seem to find a setting for that. How might I accomplish it?
Should I have anything in the rollback section? I added the same custom action for the install/uninstall, figuring it would be smart enough to uninstall the service if the rollback occurs after the service was installed. Is this correct? Would it be moot if I installed on commit instead?

Related

Delete the installer after installation

I'm trying to have the installer [NSIS] deleted after my electron app is installed on a device, so that the user needn't do so
Is there a possible way to achieve this
So I would not really recommend it but you could try to use the Delete function, specify your installer-file and set the /REBOOTOK Flag.
The code would look something like this:
Delete path\myInstaller.exe /REBOOTOK
This Flag tries to Delete the File right away and if it fails, wich it will since the installer is running, it will delete it after a reboot.
Just keep in mind that you would have to reboot your computer after the installation or the file will not be deleted.
Let me know if this solved your problem.

Granting "Local System" permissions the installation folder in Advanced Installer

I have an "Advanced Installer" project that I am trying to use to install my "TopShelf" windows service that I have built.
I found the spot in Advanced Installer to grant permissions to the installation folder, but I don't see a way to grant permissions to the "Local System" account.
Manually, this is done by going to the security option in the properties of the folder and adding a user with the same name as the computer name but ending with a $. For Example MyNiceComputer$. (Oh, and you have to select the "Computers" option in the types area.)
But there is no way to do all this in Advanced Installer. If I do make one like MyNiceComputer$, it just makes an empty entry in the security tab. (No Permissions on it, even though I setup for full control.)
Has anyone ever needed to do this with Advanced Installer?
Additional Details:
I am installing an app that runs as a windows service. (It is a console app built with TopShelf).
Our company policy is to install all our applications into a folder that looks like this:
C:\OurCompanyApps\MyApp
When I create the installer, it runs fine, but then I when I start up the Windows Service, I get the following error:
Windows could not start the MyApp service on Local Computer
Error 5: Access is denied.
But when I grant access to Local System (by giving Full Control rights to myNiceComputer$ on the MyApp folder), then this error goes away and the app runs fine. From what I read, this is because the application is running as Local System.
It seems odd that it needs full control but it does not work without it. (But as far as I can see, the contents of the folder are un-altered).
#Bogdan Mitrache seems to indicate that granting permissions to Local System is not possible via Advanced Installer. This is good to know (so I don't waste more time looking). I will probably ask my System Admins for a dedicated system account to run my service as. Not ideal, but it will serve as a work around.
So, in one of my "less finer" moments of debugging, I mixed up two different things.
There was also a file missing, (my config file). I restored that and changed the permissions at the same time. But then I forgot to go back and verify which one was the actual fix. (I know, not good debugging.)
So, the Access is denied error was due to a missing file.

How can I prevent a pop-up asking to shut down services before uninstalling

I have a WiX installer that runs a program that downloads the latest version of my code and installs three windows services. I have a custom action runs another program that shuts down and uninstalls the services during uninstallation, after InstallInitialize. The uninstaller also deletes all files and directories that get downloaded. However, when I RmeoveFile actions to delete the files, it prompts the user to shut down the services, since it must detect the conflict. I would like to avoid this, since my custom action does that anyway.
So I need a way to do either of the following:
Run the custom action (and thus my program that shuts down the services) before the installer does whatever check it does that tells it that the services need to be shut down.
Tell the installer to automatically shut down the services without prompting the user to do so. Unfortunately, the install package doesn't include the services, they get downloaded by my app, so I"m not sure how I"d do this.
Can either of these things be done?
The easy fix is to get rid of the custom action. Windows Installer can be told to manage services that it didn't create. Just author ServiceControl elements like this:
<Component...
<ServiceControl Id="sc1" Name="fooservice" Remove="uninstall" Stop="uninstall"/>
</Component>

Click-once for services?

I have an app that runs as a service, and I'd like it to be able to check a URL to see if a new version is available, and if so to download and install it. I can manually hack something together, but would be great if I could create an MSI package to update the service, and any other components that are part of my distribution. I'd also like it to be done without any UI, so the user is unaware of the update.
Are there any good solutions for this?
This could be tricky depending on what your update might want to do.
If you intend on deleting and re-installing the service, this may require a reboot, which will certainly be visible to the user.
In order to replace the components of the service, the service has to be stopped first. If your service itself is detecting the update availability, it may have to kick off another process to stop the service, run the installer/updater and then restart the service.
Try installer.codeeffects.com. It has this feature.
You could try MEF (http://www.codeplex.com/MEF) and use
[Import("http://someUrl/someComponent")]
public ISomeComponent SomeService;
Its not actually an auto update, but the service could be always up to date. I am not sure if it works.. its just an idea :-)

WSS caches old Workflow version

I'm currently developing three workflows that are supposed to handle the status of items in different lists.
Each Workflow is attached to a separate list.
When I'm deploying and debugging in my development Environment, everything works fine.
Except for the case, when an item is created via an incoming mail.
I already figured out, that I have to restart some services and then it'll work, but I'm still not sure wich of the services is caching the workflow.
Afterwards I build a .wsp file which I deploy on a server.
Each time I deploy the solution, I do a retract and delete solution first.
After deployment I'll recreate the workflows on the lists
It seems to me that this has no effect. An older version of the workflow is still triggered, if I create a new instance in the list.
I already restarted the whole server and still no result.
Has anyone an idea what else I could try in order to get this working?
Thanks in advance.
If Timer Service is the one that calls your code, then restart Windows SharePoint Services Timer (OWSTIMER.EXE).
When workflow waits on something, it gets serialized (hydrated). When event happens, OWSTIMER.EXE deserializes (dehydrates) and continues workflow execution.
So timer is the one that wakes workflow up.
So this problem kind of resolved itself.
I was reading an article on Kirk Evanns Blog on an issue with the development of workflows in VS2008 for WSS.
I had not realized that I still had an illeagle reference in my Project properties.
I removed the reference. The second thing I tried was deploying with -upgradesolution rather than doing a retract-delete-add-deploy...
I don't know which of both did the trick, but I can finally see the new workflows kicking in.
Thanks for your help.

Resources