I have an application with a project- and serviceinstaller in it. The installation usually works fine except in some cases when installed through PSEXEC remotely.
I wonder, where in the code I can intercept and check if the specific service is already installed and either, depending of best option, uninstall it or skip the current installation of service (but still continue with the overall install).
You can try uninstalling it unconditionally every time before you install.
Related
I have application on C# created in Visual Studio 2015. I added installer project and created installer of my application. My installer saves path to install directory of my app in registry.
Is it posible when run installer to check if app is currently istalled - run it, if not - run installation progress?
My purpose is: I need to create a CD disk with my app. When user inserts this cd disk at first time the installer is run. When user inserts this cd disk another time the installed app must run without install process.
Autoplay of inserted CDs is something that is frequently turned off (the security risk) so I wouldn't count on anything automatic happening.
The normal behavior of inserting a CD and "running" it for an installed product is that a maintenance/repair operation occurs. It's probably not a good idea to change this behavior. Also, if your installed product is broken in some way and goes into repair mode then the user will be asked to insert the CD to get the install repaired (such as installing deleted files) and again it wouldn't be a good idea if inserting the CD broke this behavior and decided to run your app instead (or at the same time).
So this isn't really an install question because it's about the design of the program you put on the CD that deals with all this when the user runs the CD. It will need to see if the product is already installed, and if it is then run the installed app, except that the user may have put the CD in because Windows asked them to for a repair, and I don't know how the program can detect that it was inserted for a repair. If the product isn't installed then you run your setup. This all code you'd need to write, dealing with the issues that people have raised.
There are many issues here, and also I've never seen a product that behaves like this, so that's something else that users don't expect. It's not a good idea, as everyone is saying, and you almost need to decide which features of Windows Installer you want to break, such as repair and maintenance.
I've created a Windows Service project in C#, just some very simple code. It worked when i installed the service, but now I have to add some code and so on,but that has caused some issues:
1) When trying to uninstall using "installutil /u" it says its removed however its still on the service list in computeradministration.
1a) I tried to delete it with cmd using "sc delete ServiceName" which removes it from the list
2) BUT when i install the new build it succeeds, however it still uses the old build for some reason, and im kindda at a loss.
You only have to install once. The service will be registered with the .exe you registered using sc or installutil.
To replace the binary, just stop the service, replace the binary with the "new" one and restart: the new service will be running.
Also, you have to restart services.msc to see that some services are removed (there seems to be some "pending removal" flag).
If your service is in use (e.g. it is running) when you uninstall it you may have to restart your computer after uninstalling it before it is completely uninstalled. installutil and sc does not give you any information about this. And when a service is pending removal you can get into all sorts of problems if you try to install it again (which seems to the problem that you experience).
Make sure that the service is stopped before uninstalling it to avoid having to restart your computer to complete the uninstall.
If you just want to update the binary of the service you can simply stop it and replace the executable files before restarting the service.
I have this scenario.
I am installing an application through a custom installer application(.NET application).
Since the application requires atleast .NET4, there is a check in the custom installer to see if it is already installed.
In case it is not already installed, the custom installer attempts to install .NET4 through a batch file.
The problem here is when the .NET4 installation is going on, it throws a dialog saying "The following applications should be closed before continuing with the setup : Custom installer"
i.e The .NET installation is asking to close the application which invoked it.
What should i do to avoid this deadlock?
Thanks in advance.
Just close it, install .NET and then try your installation again.
I'm not sure what happened, but my installer is in a weird state--when I install my MSI, it doesn't seem to be running the current version of the code (I'm using Custom Actions). I verified it by placing some MessageBox.Shows and sure enough, they are not popping up.
It's possible I may have had a few unsuccessful installs previously which may have put the installer in a bad state...but how do I go about resolving this?
Thanks...
If you think you are running older copies of your .msi code, the best way to resolve it is to delete all files from your %temp% directory (type "%temp%" in the windows explorer address bar and you'll see the contents of this directory and delete everything, then try again.)
You shouldn't expect MessageBox.Show to work in a .NET custom installer action. Those actions run in the context of the Windows Installer service, which doesn't run on the interactive desktop. Try logging to the event log (or any other I/O operation that doesn't depend on the current windows desktop and doesn't require an administrative or current-user security token) if you want to debug your custom action.
I have a project, in VS 2005, which has a console application and a setup project associated to install the application. I also have an installer class in the console application that the setup project will use to do some validation before installation. Those tasks are checking the database connection string and checking some directory locations to make sure they exist prior to installation.
I am getting an error code of 2869 when I try to install the application. All the code is written in C#. I have googled for this error code on Windows XP, but only found articles that deal with Vista and Windows 7. Any ideas what might be happening? Is there a workaround?
This won't help with fixing the installer code, but just in case this happens to anyone when doing in install on a Windows 2008 Server you probably need to run the installer from an elevated command prompt:
Open a command prompt with Run As Administrator and then run the
installer
msiexec /i installer.msi
Installer errors are difficult to debug, you can try to :
Look in Event Viewer / Application for logged exceptions
Surround your code with a big try/catch and a MessageBox.Show(ex.ToString()) in the catch clause
Generate a log when installing: msiexec /i "installer.msi" /lvx "log.txt" and look in it for clues
Error 2869 is documented as a dialog issue with the Windows Installer dialogs. The only reason you see it is that the setup is showing the error dialogs and there is a minor issue with it. The true error will be earlier in the log. In other words it's a meaningless downstream error from an install that has already failed. Look earlier in the log for the actual error, which nine times out of ten will be a failed custom action.
To get an idea of what happened, you can use Sysinternals' Process Monitor.
It automatically instruments your operating system and is portable so you just need to do the following:
Download Process Monitor from https://technet.microsoft.com/sysinternals/processmonitor.aspx
Start Process Monitor
Set Filter "Process Name is msiexec.com" to monitor your installer
Start your installer (e.g. setup.exe) (no need to modify or run it with special command line switch)
Check the monitoring log for errors (file access, registry, etc.)
In my case Process Monitor showed me the cause "DISK FULL" at file extraction leading to error code 2869.
I had this error as well and pursued the wrong course going after what was thought to be a "Run as Administrator" issue as explained above and in other forums.
I tried many solutions all dealing with Run as Administrator....Nothing worked.
I built a Windows 10 VM and tested the install in the purest environment I could and got the same error during the installation execution.
At the end of it all....
it turned out I got the error code 2869 because the Serial Number I entered was not valid.
(The serial number I was given by my predecessor had more entries than needed).
Once I entered the correct serial number it turned out "right as rain".