Setup project modificatios - c#

I have made a application using c# database and sucessfully made a setup projects that outputs setup files needed to install that application but when i install it on other machine first I have to update installer then framework 2 sp2 and then SQL server and when I tell my client that he would have to do the same he just ........... so I want a way to embed these things in that installer wizard so that in a one go every thing gets installed without prompting for each thing . for example when we install visual studio every thing gets installed without asking permission as we select what to install.so is there a way?

If you have a setup wizard for each of the parts you need to install, you may want to take a look at Inno Setup, as you can embed those installers in a new one which in turns executes Database/.NET Framework/application setups in correct order to properly configure all the pieces of the solution on a machine.
As setup applications usually have a way to configure options by command line parameters and run silently, you can collect all parameters you need in the new wizard page and call any of the needed installers just by adding a line in the [Run] section of the script.
With Inno you can even embed a pascal script to run code at wizard run-time, for example to inspect destination machine in order to run or not run some installers. You are able to download required extra-files on demand also.
When you compile a Inno setup project with default options, you get a single executable containing all what you need to install your project, making deployment very easy.
This options may be available for the tool you're using now to produce your installer.

Related

Process of ClickOnce and prerequisites

I have an application I want to build and deploy via ClickOnce. But we want this to be a process that can be run outside of VS through scripts, for either test, business UAT or production environment.
Each separate environment requires a different .config file to be used and a different web server to be deployed on and for update location.
The application also has prerequisites of .NET runtime 3.5 and Crystal reports.
I have looked into using MAGE to create application and deployment manifests, and if I do a code BUILD, then use MAGE afterwards as per each environment, as well as having the script copy over the correct .config file, this creates what I think are the correct manifests for each environment at the time of running the script.
But what I'm struggling to do is include the prerequisites. If done through VS, you can specify a setup.exe package which gets built with the pre-reqs and deployed alongside the application and when you click on the download link, it installs the pre-reqs from setup.exe and then the application.
But how can I do this manually outside VS? I can build the setup.exe through VS with the right URl location but then how do I link the setup.exe to the application as a pre-req using MAGE to generate the manifests?
The problems we have are 1) The users do not have admin rights to download and install packages, only to install things via clickonce so the pre-reqs have to be installed under the click once security umbrella.
Thanks
ClickOnce and prereqs cause lots of confusion. The setup.exe that Visual Studio generates has nothing to do with ClickOnce. The only minor link between the two is that the setup.exe will launch the ClickOnce application once it finishes. That's it. So thinking users will be able to install your prereqs "under the clickonce security umbrella" is a mistake. If they are not an admin and a prereq install requires admin privileges, they won't be able to install it.
My advice would be to generate your setup.exe one time. You shouldn't need to keep doing it unless your prereqs keep changing. Use Visual Studio, generate the setup one time, then use Mage for the rest.
Edit
In general you make the setup.exe available and depend on the user to know if they need to run it or not. If they already have the prereqs and run the setup.exe, nothing bad happens. It sees that everything is installed then launches the app.
Usually you're going to direct users to run the setup.exe. The next time they want to launch the app they should use the start menu shortcut (assuming you didn't go with "Online Only"). I've found this to be the least confusing set of instructions for users.
Remember how Visual Studio does extra, non-ClickOnce stuff when you publish (like the setup.exe)? It also creates a simple html page that has links to both the ClickOnce manifest and the setup.exe and an explanation. It also has some javascript that checks the UserAgent string to determine if they have the .NET Framework installed. Again, this isn't ClickOnce. It's just something nice Visual Studio does for you. If you like it, use it. I kind of like skipping it and going with the run setup.exe to install then launch from the start menu.
codeConcussion is right, you can't ever actually have the prerequisites instill directly from ClickOnce. You should just generate it once and then you have it ready for your external ClickOnce tool.
There is an option other than Mage. You could use my companies tool, ClickOnceMore, as your ClickOnce build software. It's been designed for people who want to use ClickOnce but don't want to build with Visual Studio.
It can hook into the setup.exe generated from Visual Studio (details here) so should satisfy all your needs.
Why do you want to build setup manually if everything can be done via clickonce ?
You can select "Download pre-requisites from same location" option from prerequisites form if you want to include .netfx or crystalreports, download bootstrap packages for .netfx3.5 & crystalreports and add to folder (for windows 7) "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages" . The deployment project will automatically include netfx & other packages along with setup.exe.
hope this helps.

Installing multiple MSI's dynamically Visual Studio C#

I have three windows based application. I need to deploy them into a single msi file. The first two files are kinda like the check for the proper computer, like the specific computer name and login username. The problem I have is that how can I deploy all these three application into one msi file. And the installation goes like this ?:
1: Install the window application A
2: If application doesn't install properly then stop installation and delete application B and application C. However if everything goes fine then install the final main application, Application C.
Addition information: The application A and Application B is basically kinda checking the username and proper name of the computer and then printing out the specified values into the registry.
Appreciate help in advance :)
If you're using the VS Setup Project installer, this is a little more difficult than it has to be but not by much.
The first thing you should do is pick a "primary" application. This application's installer will be the one invoked by the user to install all three and will control the other two.
Now, deploy the other two applications into their MSI files. This process is relatively straightforward; the only thing you must do is ensure that any custom information that may be needed by the setup wizard can be defined using command-line parameters, and that the installation can be performed in an unattended manner. VS Setup Projects allow both of these; you have to define the parameter name of any custom field in your wizard, but given that the unattended feature is "free". Once these MSIs are built, add them as files to be installed to the main application directory of the primary app.
Now, you must define custom actions in the installer of the primary application. This is done by creating a class inheriting from System.Configuration.Install.Installer, decorating it with a RunInstaller attribute, and specifying this Installer class's project as a set of Custom Actions for the installer.
In the Installer class, override the OnAfterInstall, OnBeforeUninstall, and OnRollback methods. In the OnAfterInstall method, call Process.Start to invoke MsiExec.exe with the /I option to install, passing the path and name of the first application's MSI, and specifying the "/q" option to perform the install silently as well as any properties which must be set (installation parameters; path, install level/components, app settings, etc). Repeat for the other application, then repeat the process with the OnBeforeUninstall and OnRollback methods, but specifying the /x option to uninstall the MSIs.
When you're done, you should have a single MSI containing the other two MSIs, that when installed will silently install the other two and when uninstalled will uninstall the other two. For more advanced installation control, you can differentiate between an "install" and a "modification/repair" by examining the savedState dictionary in the handlers (during a repair, you should repair the child apps instead of trying to reinstall them), and you may make installation of the other two applications optional using a Components dialog in the install process (the information will be passed to the custom action handlers, and can also be used to choose whether to copy one or both MSIs to the primary app directory). Finally, you may choose to override OnAfterCommit and remove the MSIs (but if you do so, you will have to uninstall the child packages using Windows' retained copy of the MSI, which can be tricky to find).

How do I install multiple setups in a single installation?

I have created a piece of software to download data from finger-scanners and write them to a database. The drivers of them should be installed first, so the driver setups should be installed while he installs the software. I don't know how to do it. It is written in C#.
You may create a setup for your app using Visual Studio Setup Projects. It helps you to run external exe s or msi s when your setup runs.
Go to File -> New -> Project -> Other Project types -> Setup and Deployment to create a setup project as you prefer. Then you may use Custom actions to add the feature you requrire. (The 3rd and 4th links below shows about custom actions).
Refer to:
http://www.codeproject.com/KB/dotnet/Win_App_Setup_Project.aspx
http://www.codeproject.com/KB/install/ExtendVSSetupProject.aspx
http://devdump.wordpress.com/2009/01/17/setup-project-custom-actions/
http://www.simple-talk.com/dotnet/visual-studio/visual-studio-setup---projects-and-custom-actions/
Also you may create a script based installer for your app, which will let you create an installer with with high customizability and features.
Refer to
Main Page - NSIS
Embedding other installers - NSIS
Hope this helps...
You can't run an MSI based install from a Visual Studio custom action. MSI doesn't permit that kind of recursive install (because it's a transaction, and because it tries to use system restore points per install etc). That's part of the reason why other prerequisites are installed by the setup.exe program. The bootstrap manifest generator can be used to generate custom prerequisites (first topic in this forum).
From:
https://social.msdn.microsoft.com/Forums/windows/en-US/dfb5de84-a0f0-4639-958e-8cbf4cba6e90/setup-deployment-project-cannot-launch-another-installation?forum=winformssetup

how to use VS Setup and Deployment project and build an .msi file to install the program?

i wanna deploy a C# Windows Application project using Setup and deployment project technique
but i don know what should i use
after i open File > New > Project > Setup and deployment > ....
then what ,, what should i do next
In the past I've used the Visual Studio Setup Project or Innosetup for my programs. I prefer to build .msi's over exe's so Visual Studio Setup Project has been my goto for a while now. It is however, very lacking in capabilities. The interface is not intuitive either in my opinion. Every time I build an installer there is a lot of trial and error install/uninstall to get it right. Other's have pointed out WIX and I've looked into it. It appears to be very flexible and since it is open source, we should be able to count on it for the long term.
Here is a recent article about WIX. What I found interesting is the article claims (see link in article) that Visual Studio Setup Project is being End Of Life'd in VS 2010 + NEXT_VERSION. This is a little disconcerting to me. Since I don't want to begin to rely on the new Install Shield "Lite" in VS, I'm going to put effort into learning WIX. I hope it'll pay off in more flexible builds for my applications as well.
All that said, when creating a VS Setup project, I usually use the wizard to put in the initial plumbing. You'll point it at the files you want in the .msi. Typically for me this means the "outputs" of one or more programs in my solution. Any managed assemblies referenced in the programs will automatically get picked up as dependencies and included. Unfortunately unmanaged assemblies don't and I usually have to add them manually using the "File System Editor" mode in the Setup Project UI. Adding shortcuts is a little hokey as well. You right click under the start menu and desktop section of the "File System Editor" mode and select create shortcut. This is all by memory so hopefully I'm getting this right. You will certainly have to test your installer multiple times before you get it just how you want. I like to test under a VM as well.
Finally, the VS Setup project produces a setup.exe and .msi file. Setup.exe is used for detecting and installing dependencies (such as .Net) before unpacking the actual DLL.
When u do this File > New > Project > Setup and deployment >
then right click Application folder> Add > File...and add your app's .exe file and also you can add shortcuts of your app in desktop and program's menu
I would recommend you to go for some tool for creating msi.
I am using WIX
What you need depends on... what you need.
For a large percentage of applications, all you need the installer to do is let the user choose an install location, copy files to a directory structure at that location, and create a few shortcuts. For that, a Visual Studio Installer -> Setup Project is fine. It can handle this basic functionality, as well as installing prerequisites like the .Net Framework redistributables, providing custom install options, and/or writing simple registry keys. The Setup Wizard creates a Setup Project as well, but runs you through a wizard to set up the basics. This is a good option if you've never created an installer before.
If you want this application to be controlled by a larger, more custom install, choose the CAB Project; it will simply pack the necessary files into an archive that is easily accessible from another setup project.
If you are publishing a class library, use a Merge Module. Merge Modules work within install programs themselves, providing files needed for the main application to work.
If you need serious customization, or you want to interface with existing InstallShield logic, I'd get a third-party installer. I've worked with InstallShield before, and it's pretty full-featured, but by the same token, the installers it creates are applications in their own right and can take days or weeks of logic programming to "tweak" to your satisfaction.

Creating a patch to upgrade .NET application

I would like to create a patch for my .NET application. The requirements are:
Find the installation directory
Overwrite the old files with the new ones
Restart a windows service
I want to send the updater to the user so that they simply run it and update the application. My original installer is created using Visual Studio Deployment Project.
I did alot if research, and found this:
https://stackoverflow.com/questions/3767/what-is-the-best-choice-for-building-windows-installers
How to Update the installed Window Application (Creating Patches)
http://wyday.com/forum/viewtopic.php?f=1&t=245&p=793&hilit=offline+install#p793
http://www.advancedinstaller.com/user-guide/tutorial-patch.html
I tried created another installer which would just contain the files I need to replace, however I could not find a way to determine the installation directory of my application.
WyBuild seemed like a good solution, however they do not support an offline install and require you to host the update files on the server.
I tried creating a patch using Advanced Installer but it just generates a bunch of build errors that I could not fix.
There are tutorials how to modify the MSI files using Orca or WIX, but that seems alot more complicated than it should be.
I am tempted to roll my own but I am not sure how to go about it, and this seems like such a basic requirement that there's got to be a solution out there already.
If you already use a a VS Setup Project you can deploy the new version of this project and it will upgrade existing installations. Have a look at the setup and upgrade ids. The stop and start of the service can be done by custom actions that can be defined in the project and will be executed i.e. when your setup is committed or rollbacked etc.

Categories

Resources