Windows Service, how can I uninstall from VS Setup project? - windows-services

I have created a windows service, it works great, but as soon as I try to install the service, it removed the directory, however, the service did not get removed, and when I try to install the service again, it give me an error 1001: Service already exists. How can I fix that?
And also, is there any code for me to remove the service when I uninstall the project?
Thanks

You can use installutil.exe to install or uninstall a service from the command line.
To install: installutil yourproject.exe
To uninstall: installutil /u yourproject.exe
You can also use sc delete from the command line. Type sc by itself to get the list of parameters.
Lastly you can use the ServiceInstaller.Uninstall() method if you're using the predefined installation component. You'll have to call it from the Uninstall handler of your installer.

You might need to remove it from the registry at [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services]

Have a look at this post. It references another one, so, between them, they may have your solution.

Related

QuickBooks 2019 Desktop Accountant Silent Install

We've been trying to deploy QuickBooks 2019 through SCCM for a while now (using a transform file since Intuit refuses to implement any sort of command line switches for whatever reason). The normal method for deployment using applications or packages hasn't worked. I'm using msiexec in a batch file to run the install, but it doesn't seem to work with "/qb" specified. If I remove the "/qb", the command runs and the install works just fine, but that obviously eliminates the silent part, which is the whole point of attempting this. Any advice on what else to try to get this working is appreciated. Here's the command as it is right now:
msiexec /i "%~dp0QBooks\QuickBooks.msi" TRANSFORMS="%~dp0QBooks.mst" /qb
Try the /qn instead of the /qb.
Would be willing to share your transform file or share what needs to be changed on the transform file?

Manage Xcode Command Line Tools version for each user

I am using two different Xcode version with 2 different Command Line Tools version as well. On my Mac I have one user for development and the other one as a Jenkins slave and, for some reasons that don't belong here, I need to use different Command Line Tools version for each user. The thing is that every time I select a new Build Tools version, changes apply to all users.
Is there any way to select Build Tools version for EACH user?
The most direct way to solve yout problem would be using the environment var $DEVELOPER_DIR, as you can see here:
What is the difference between setting DEVELOPER_DIR and using xcode-select?
You can try to use this wrapper. It allows you to execute xcode-select without sudo permissions:
https://github.com/detroit-labs/safe-xcode-select
Alternatively, if that doesn't work for you, you can try allowing xcode-select to be executed with sudo permissions but without the password:
https://encyclopediaofdaniel.com/blog/sudo-without-a-password/
I hope it helps.
Find your toolchain name (say swift-dev) and then run:
export TOOLCHAINS=swift-dev
on login?

ethermint: command not found, When attempting ethermint installation?

I'm following the steps to install ethermint on top of tendermint that are listed on the README on this github page: https://github.com/tendermint/ethermint, but at the step ethermint --datadir ~/.ethermint init setup/genesis.json, then I get the following error: ethermint: command not found
And yes, I installed tendermint previous to my attempted installation of ethermint.
While the solution I figured out for my problem is contained on the GitHub issue page linked above, I also wanted to include it here for the sake of people who have the same issue.
OK, so I fixed the problem, and it was so infuriating. It turns out
that whenever I opened a terminal, then the go version would default
to go1.6, even if I was in the go1.8.3 directory. To solve the error,
you need to delete the old go version off of your computer, and then
use gvm to set the right go version. Thanks to everyone who helped me
solve this issue.
Check your current directory:
ls
if ethermint doesn't exist you need to install it again

Windows Service Installation .NET-4.5 Cannot load the exe file

I am trying to install a windows service with installutil in cmd and this is the msg I get:
Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///D:\inst
all\DemoWinProject.exe' or one of its dependencies. The module was expected to contain an
assembly manifest..
Can you help me out whats the prb ???
I have not seen that problem directly, but a very brief search found this link that may have the answer you seek. In a nutshell, make sure you're using the right version of InstallUtil.exe for the .NET framework targeted by your application and that you do not have any x86/x64 inconsistencies within your assemblies.
FWIW, I personally do not like using InstallUtil.exe to install my Windows service; I prefer the Windows service perform its own installation/uninstallation. This is a fairly straightforward thing to do, as I've shown here.
HTH.
I fixed this problem by writing the path where my InstallUtil.exe is and then Write the command InstallUtil and then write the path where my exe file that needs to be install is.
Note : Make another copy of debug folder in another place and install the exe file from that path. This is because anytime you make a built the exe file changes.So to prevent the changes of the installed .exe make a copy of it in another place and install it.
ex.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>installutil c:\Documents\Debug\WindowsService.exe

the installed product does not match the installation source(s) error when uninstalling a windows service

when I try to uninstall a windows service from the control panel, I am getting error "the installed product does not match the installation source(s), until a matching source is provided or the installed product and the source are synchronized, this action cannot be performed". actually I do have the original MSI file, but I modified some settings in the config file (where it is installed) after installation, so that might have caused it, how can I uninstall it now?
The MSI you think is the original probably isn't really. It sounds like you got yourself in a situation where PackageCode ( GUID ) A is installed and now you have an MSI with PackageCode B.
Take the MSI you have and run the following command:
MsiExec.exe /I foo.msi REINSTALLMODE=voums REINSTALL=ALL
This will "recache" the MSI with the updated PackageCode. You should then be able to uninstall either through Add Remove Programs ( Programs and Features ) or with the command
MsiExec.exe /X foo.msi

Resources