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.
Related
I'm using Microsoft Visual Studio Installer Projects for my Hybrid Widndows Forms/WPF project. I need to make sure the user has closed the Application (an older version), if active, before the installer can proceed, can this be possible with a Visual Studio Installer Project?
All I've seen so far is that the installer adds by default a dependency to .NET Framework and it won't run unless the dependency is installed first.
UPDATE: Windows Installer-Avoid FileinUse dialog box when Installing a package
for a list of possible, alternative options in addition to RestartManager support.
RestartManager: The RestartManager feature of MSI is designed to allow your application to gracefully shut down and restart itself during an installation process: How do I add support for Windows Restart Manager to my application? (Advanced Installer)
In essence: The whole idea is basically to prefer restarting applications rather than restarting the OS. To that end:
Your application calls RegisterApplicationRestart() with a command line specified for its eventual restart - it "signs up" for restart management.
Your application watches for WM_QUERYENDSESSION messages and shuts down gracefully saving data in an appropriate way when told to do so.
Then RestartManager can restart the application when finished installing (restart can be disabled).
Importance: Just to state the obvious: rebooting a knowledge workers PC is a big deal (ethics of rebooting - no less - read towards bottom). This is why you should avoid reboots whenever possible. RestartManager support for your application can help (restart application rather than rebooting OS). This feature helps enormously for large scale deployment where you might target thousands of PCs. And please make sure your QA guys understand and know how to test the functionality / scenario relating to RestartManager.
Also avoid setting REINSTALLMODE to amus (force overwrite) - which can trigger unnecessary reboot prompts.
Links:
How does Windows Installer close an application during uninstall?
Windows Installer-Avoid FileinUse dialog box when Installing a package
In-use files not updated by MSI-installer (Visual Studio Installer project)
https://media.flexera.com/documents/minimizing_reboots_on_vista_systems.pdf
I have created an installer which installs windows service. I have used Visual studio default installer in VS 2010.
The service will access and write on the database file(SQLite) present in the installation folder.
During uninstall when the service is stopped or running, the service is uninstalling without any error.
But if the installer is migrated from version 1 to 2, and the service of previous version is running then"The file is being accessed by some application. Try again" error has been shown, since the previous installation service accessing the DB file.
So I need to stop the previous version service before Installing new version.
I have a custom action script for managing install and uninstall.
In BeforeInstall method I have written code to stop the service using ServiceController. That can stop the service.
ServiceController service = new ServiceController("SERVICE_NAME");
if (!(service.Status.Equals(ServiceControllerStatus.Stopped)))
{
service.Stop();
service.WaitForStatus (System.ServiceProcess.ServiceControllerStatus.Stopped);
}
But even before BeforeInstall method the installer is copying new version files replacing my previous version files.
I always have same installation folder.
So if I write code to stop the service in BeforeInstall custom Action it will still throw error, because the DB file being accessed by previous version service was tried to delete by new version.. So I am getting "The file is being accessed by some application. Try again".
So I need some hook even before the installer copies the files to the installation folder. So that I can stop the service before the installer try to update the Db file.
Any idea would be appreciated.
Windows Installer doesn't have a concept of "before install". This is a Visual Studio Setup and Deployment project abstraction. This project type failed to expose many underlying Windows Installer features and this is why Microsoft eliminated it in VS2012.
Another concept that isn't exposed is the ServiceInstall and ServiceControl tables. This is why you are being forced to write custom actions. Custom actions that are hosted in such a way ( beyond your control ) to tattoo the MSIEXEC process with a CLR version and throw modal 1001 exceptions (even during silent installation) when there is a problem.
But there is a solution. Switch to a better tool such as free and open source Windows Installer XML (WiX) and Industrial Strength Windows Installer XML (IsWiX). With these tools you can create a windows service, create the installer for it and test the install/uninstall on a VM in 10 minutes. Watch my silent demo at:
Building and Deploying a Windows Service using IsWiX
I developed a winform application using C# in visual studio 2008. Now i want to run the exe on another PC which doesn't have .net framework or Visual Studio. I am sending the application using Zip via email. The second PC downloads that application and extracts into a normal folder and then it executes the exe file.
But i am getting the exception that .net frame work v 2.0 must be installed.
Can you please tell me how to run that exe without .net frame work installed?
(Amended for #Merhdad's sanity :-))
The short answer: You can. You shouldn't.
The long answer: You could technically create your own unmanaged bootstrapper that goes and download the .NET client profile redist and silently installs it using the MSI APIs, and then loads the CLR and hosts it in the process in order to execute the managed code, after which it silently uninstalls the .NET Framework from the machine.
The Disclaimer: I know few people that could pull that off. They would be the first to tell you not to do it.
The alternative hack answer: You can also use one of the tools #Mehrdad mentioned. i can't comment whether they work or not. However, you should be aware that this leaves your app linked to a specific snapshot of the .Net framework code, and for every security update you need to take, yuo have to relink and release an update of your application as well.
The alternative open source answer: You could ensure your WinForms app builds and runs on Mono, and deploy Mono side-by-side with the app. I've heard it supports that scenario.
The alternative IT answer: You could create a VM appliance with stripped down Window image that has .Net and your app only, and ship it as a single executable.
The right answer: Create an installer for your app that installs the .NET Framework for your customers.
Yes! You can do this with a variety of programs, and Spoon seems to be among the most up-to-date ones.
(Of course, this doesn't mean that you should, just that you can.)
This cannot be done. You must have the .NET Framework in order to run the application.
I solved the problem.I added a package in visual studio.I added Setup and deployment as a new project to my solution.later i added exe to that package.so if client machine runs the setup it'l create exe and can run the application successfully.
yeah,you can do that by converting your whole application to an installer.just check it out, it will helps u a lot
http://www.youtube.com/watch?v=PCnfGUT-K-4
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 want to make an advanced installer for my C# application. |I want my application continue its installation after the pre-requisites been installed.
My scenario is:
myApplication requires .net Framework 2
it redirects the user to the Microsoft website.
the user installs the framework.
the installation requires to restart the PC.
STOPPED INSTALLATION
After this step (after restarting) I want myApplication to continue the installation (go to the last stage of the installation)
Any suggestion on how I do this ?!?!
I would suggest taking a look at the nullsoft install system. Use the Modern UI theme and the DotNET macro (http://nsis.sourceforge.net/DotNET). That's everything that you are looking for prebuilt, for free, and you can be up and running with very little effort.
I've had experience releasing applications with this route and it works very well.
Things like InstallShield, or one of the other installer creation tools would be able to handle the pre-requisite side of things for you. If you want to roll your own, then you could check for the framework, perform the various steps you mentioned to install it, then add you setup application to the RunOnce registry key so it starts again on startup.
Looking at something that would handle all the pre-requisites etc for you would be my choice though :-)
Install in this order:
Install the .NET framework
Install your app.
Restart if needed.
You can create an installation project in VS2005/8 to handle installing your app and any needed dependencies.
Are you aware that your compiled c# app itself will do this? The bootstrapper compiled into a .Net exe will contain a redirect to get the framework with a working link to the microsoft website.