I need to create a simple installer of sorts for a different application. That other application already has it's own simplistic installer, and I don't want to meddle with it.
The reason for my own installer is to allow the user to install SQL Express if (s)he so chooses, and also to pre-install any other basic requirements for such a procedure.
At the moment, here's where I'm at:
I've created a single Windows form application, with big buttons (this is for a user which likely won't be very good with computers) to install SQL Server Express (using silent install with a predefined set of arguments) or the actual application, along with some helpful text to let the user know what's going on. Something along the lines of Visual Studio autorun window.
I've also added the standard set of pre-requirements to the application (.NET, Windows Installer).
Everything works OK if I run the app by using the executable. HOWEVER, if I publish it to create a ClickOnce application (so the pre-requisites are installed when needed) and run it, it stops running other installers.
EDIT: Apparently the problem with not being able to run other application from a ClickOnce application is only on my end, and probably deserves a new question, not necessarily here on StackOverflow (perhaps on MSDN forums?).
In your program before launching the installer you can check if .NET is installed. Its pretty easy to check if a particular s/w or a version of s/w is installed. Write a program that will check HKEY/LocalMachine/Microsoft/Windows/CurrentVersion/Uninstall and in that there will be list of programs that have been installed on that machine. If you find then go ahead with your install else suggest user that he needs to install pre req.
When you create a setup project you can right click on the setup project, go to properties, and click on pre requisites. In that you can mention which version of .NET framework is needed and then give the location of the framework. In this link look for Huggy Bears response eggheadcafe.com/community/aspnet/2/10131905/setup-project.aspx
I've settled for a "Click Once" application. It can install all required .NET components needed for it to run, thus becoming an "sure-to-run-non-native-C++-code-splash-screen".
Granted, there ARE issues with Click Once, but this is far better than nothing. It's also better than running C++ or unmanaged code applications. ;)
Related
I am struggling with a issue of making one installer dependent upon other.Suppose i have a setup project Through which, i use to make MSI(or setup) of my c# application for deployment on windows machine. Now suppose i have another project whose MSI(or setup) is generated by another setup project.
Now what i want to make is that when my first setup is run than it will first check for whether second MSI(or setup) is installed or not. If its not installed on target machine then it first set up will run and install second setup, once second set up is properly installed then installer of first continues and completes the its installation.
I can't figure it out how can i check whether second setup has installed or not. i.e how to make second installer dependent upon first installer. I am using visual studio 2013 and the project which i am deploying is c# application
First time i am dealing with making setups for application deployment so may be my way of asking may not be good. Thankyou!
In general that is not possible by means of MSI only since you can't run two MSI installers at the same time. You'll need to use some external solution: a self-made script, InstallShield wrapper etc. The only thing you can do within the MSI is to check that a prerequisite application is installed and if it's not - abort the installation.
Yes, you need to use a packaging tool that either offer out of the box support or you will have to write your own code for this.
You have quite few options here:
-InstallShield
-AdvancedInstaller
-Wix
What you are trying to achieve is known as prerequisite or runtimes required by your application.
As J.Tribbiani mentioned in his answer the solution you need is to use a professional tool like Advanced Installer or the others, to configure your setup as a prerequisite. This is the standard procedure for your requirement.
Here is an example tutorial of how to do it with Advanced Installer:
prerequisite configuration
Or a video of configuring an optional prerequisite, i.e. which the users could choose to skip (let's say if they have an equivalent alternative or want to manually install the prerequisite)
Disclaimer: I work on the team building Advanced Installer
I'm using the Visual Studio Installer Projects extension to build the MSI-installer for my application. However, my application is meant to be running at all times, and if it's open when the user is installing a new version of my software, the open files are not overwritten, and very little to nothing is actually updated (although there are no installer-errors).
I've found that using the installer project's "Custom Actions" to run a script that closes the application doesn't help, as none of the actions are called before the files are replaced.
Is there a good way to make sure the open/locked files gets terminated before the files are supposed to be overwritten?
We had this problem, and the solution we came up with was to create two apps; the user app and an updater app. The MSI installs both. Each app checks if the other needs updating and, if it does, closes the other app, downloads the other app's updater, runs it, then relaunches the other app. Additionally, each app monitors if the other app is running and, if it isn't, launches it.
It would be useful to know more about your application and how you are doing the upgrade because:
You will normally see a FilesInUse dialog saying that files are in use, prompting the user to shut them down, but not if the install is silent.
Visual Studio setups have no built-in support for shutting down and restarting services, so if your app is a service you'll need extra work.
Files that actually do need to be replaced will prompt the user for a reboot (if they are not previously shut down) in order to replace them at reboot time.
So if you're not seeing reboot requests or FilesInUse dialogs in a UI install then something else is going on. So you need to be sure that:
a. You are really doing an upgrade where the version of the setup project has been incremented, the UpgradeCode is the same (and the ProductCode changes when you increment the setup project's version). Your symptoms could be the result of the upgrade not working and you're seeing just a repair.
b. The definition of "new version" is that you have an upgrade as in a., AND, the file versions of the binaries have been incremented. The default overwrite rules for installs require incremented file versions, so if they haven't been incremented you'll see no updates, and Windows will not attempt to show FilesInUse dialogs or reboot because there are no files that need replacing.
This isn't a solution to the problem, but rather another solution; the one requiring the least work in the end.
I ended up not using 'Visual Studio Installer Projects' for my installer. Instead I looked to Advanced Installer, which just works with no issues. Things like this is taken into account, and custom actions allow for more options.
If your project is open source, you can write to them about a free open source "professional" license, equal to their "professional" plan, which is normally $399 (onetime purchase).
REBOOT: How are you installing this MSI? What command line? If you set REBOOT=ReallySuppress on the command line, you will not be prompted for a reboot even if one is required to complete the installation of the product.
msiexec.exe /i MySetup.msi /QN REBOOT=ReallySuppress
If you are using a distribution system I suppose suppressing reboot prompts could be standard behavior. Then your product files should be put in place after a reboot (PendingFileRenameOperations or perhaps some newer mechanism).
It is also possible that Visual Studio Installer Projects do something strange that I am not aware of.
Log: I would try to create a good log file for the install, to determine what is going on:
msiexec.exe /i C:\Path\Your.msi /L*v C:\Your.log
Log All MSIs: Personally I like to enable logging for all MSI installations - as described in the "Globally for all setups on a machine" section in the above link.
Interpreting an MSI log: interpreting a log file can be challenging sometimes. Here is an answer with some links to help with this.
Reboot Manager: Reboot management is a very complex topic, and Windows features functionality - in the form of the restart manager feature - to try to minimize the need for reboots, by instead shutting down and restarting applications as part of an installation in an "auto-magical" fashion (application listens for messages and shuts itself down gracefully when told to, and the system may restart the application after the install - if configured to do so).
Updating your application to comply with the restart manager is the only real fix for such problems that you see, in my opinon.
The section "Restart Manager" in this question tries to summarize how to implement such support (maybe just read the yellow section a bit down the page).
The Advanced Installer guys have a very nice, technical article about this:
How do I add support for Windows Restart Manager to my application? Also linked to in the link directly above - still worth a direct link here I think.
According to below link
https://social.msdn.microsoft.com/Forums/windows/en-US/0b40b367-3341-43d8-b82e-1ace546969f8/how-can-installation-stop-and-restart-existing-service-?forum=winformssetup
"There is no good support in VS installs to stop and start services. During install, the issue is that custom actions run after everything is installed so it's too late to stop a service that you are upgrading or replacing. Yes, they have names like "BeforeInstall" but they really are not before the install."
I created a new WPF project. I copied the built .exe file onto another computer and tried to run the application. But nothing happened. It was just loading. Nothing more.
All my WPF projects do this thing.
What am I doing wrong? Has anyone any idea?
Edit: For somebody in the future: the question might not be clear. What I meant was that I created a simple WPF application with nothing in it and tried to run the application on another computer. I wasn't able to make it run. Just nothing appeared. I figured out that the Avast Free Antivirus was causing this problem. When the antivirus is turned off, it runs as expected. Even though it is no solution, at least we know, what was causing the problem.
You are probably missing the dot net libraries on the target machine.
For quick fix, download the dot net framework distributable for the .net version you compiled against and install it on the target machine. Here is 4.5.1 for example.
For actual distribution, look at creating an installer that will ensure all dependencies are installed with the application. InstallShield has a limited edition which may be included with your edition of visual studio
Try publishing your application using click once. You can do this by right clicking on your project > Publish > Specify the location to publish your application > Finish. Copy the files inside the Published folder to another computer and try installing by click the setup.
Note: The instructions I said above only works if you only have basic functions on your app. If your application uses SQL Server, you need to install it first on the computer that you will be installing your application in.
For your reference. How to: Publish a ClickOnce Application using the Publish Wizard
I'm trying to create an installer for my application (win form) by visual studio, creating a new project type setup, and am having great difficulty in doing so, for example:
1 When I create the installer and run it installs, but there is the option to uninstall? and I can not install the same application because it already exists on the machine.
2 In dialog window, I see you have the options to create multiple screens and add textbox for example, but where do I set the events of that textbox?
3 º This application works with sqlserver, and I can install it on the machine by the installer, but as I set him to work with my application linq, since I would have to modify the connection string on each machine that I will install the application.
I've researched a lot about these issues and I find no documentation that can teach me how to do this, if anyone knows some please show me,
I appreciate those who can help me, and sorry my english.
I answer your first question at this time due to the lack of time:
In VS, right click the setup project. You have 2 options: Install and Uninstall.
1.) You need to uninstall the program through your operating system. Go to the Control Panel, Programs and uninstall it. Then you can try installing the application.
2.) In design view you can double click the textbox. You will be taken to the method that handles the “TextChanged” event. Write your code there.
3.) If you are installing on a server you need to create a Web Setup project instead of a Setup project. The latter installs files into the file system of a target computer; whereas, the former installs into the virtual directory of a Web server.
We are working on deploying a very custom application.
The application is the main program (and only program) that will run on the PC, but it depends on multiple 3rd party installers that must be installed via separate setup programs. Some of these are standard MSI, install shield, other outdated setups, etc.
On top of that we must deploy SQL Server Express 2005, install IIS if it is not found and setup a website.
Our final end user deploying this will be a person with technical experience on a new "out of the box" PC with XP SP3.
What is a good option for developing this? WiX? Visual Studio setup projects may not cut it. There is also the issue of somehow running other MSI's while an MSI is already running.
Would it function better as a standard C# application that requires .Net to be preinstalled? Then it would merely prompt for a few options then run several installers I suppose.
Any thoughts? We'd prefer to stick to C# .Net.
Doesn't XP SP3 already have a .NET runtime installed?
If your end user is someone with technical experience then it seems reasonable to sacrifice some of the "wizardness" of an MSI package for the flexibility of something a little more raw, such as a Ruby script, Powershell script, or .NET console or Winforms app.
This comes down to the benefit vs. cost.
If this is only to be run on a single or small number of target PCs and you have the ability to support the install (even remotely), I would recommend going to a manual install for any 3rd party dependencies.
It will be much easier to provide each package's installer with written instructions and provide than to write/test/debug (and probably still support) a complex, fully automated installer that will only be used once or thrice.
If there will be many installations, the automation will give more benefit.
There is an installer product called Inno Setup that might suit your needs. It allows for custom scripting so you can detect whether all of the dependencies are installed.
If some of them are not installed then with some scripting the installer can download and install the 3rd party dependencies before installing your app. Some help with that can be found at the Code Project article. (http://www.codeproject.com/KB/install/dotnetfx_innosetup_instal.aspx)
The only problem with this route is the scripting language is in pascal.
Just a question, is the company you work for supplying the boxes because if you are then couldn't you pre-install the software? At least that way there is one less thing that can go wrong.
WIX is a fairly flexible way to create the installer (although the learning curve can be quite a bit as the documentation still is lacking). That would probably be your best bet for installing the components that are actually your product's artifacts. Have it check that the required components are installed, but I wouldn't try to launch installers off of it. Instead, like Seth mentioned, write a Powershell script/VBScript (or Console application) that will do the component checking and launch the old installers for user in the order necessary. Of course you would need a way to capture when the installer finishes before continuing on (don't know if VBScript really has that capability, so Powershell/Console app may be a wise choice). And the final installer called would be your product. This way if there's reboots required the installer can be ran the exact same way and would just keep checking for required components and firing off installers as needed.