Additional Setup in Visual Studio Installer Projects - c#

I am trying to create an installation for my project. I am using MS Access DataBase and for it to work Access DataBase Engine is required. If i download that engine https://www.microsoft.com/en-us/download/details.aspx?id=54920 from here and install it, program works.
How can i add that installation to my installation?
I am using Visual Studio 2015, C# and OLEDb.

Short Version: In essence you will need a deployment tool. List view of major deployment tools. Maybe that list view is the easiest overview? (a sense of scope). Much more detail below (and too many links too).
Details: There is some prerequisite functionality available in Microsoft Visual Studio 2017 Installer Projects, but I am unfamiliar with the details. I find this project type inadequate for real deployment work for a lot of reasons (lacking features and some odd implementations). More on this here - a few concrete problems to consider.
Several commercial tools will do this for you with special features to help make it quick(er). I verified that Advanced Installer can do it (and here is a great gateway to all things Advanced Installer. Some free features available). I assume Installshield can do it as well (certainly for other runtimes, didn't verify this particular one). Generally it will be handled by a setup.exe bootstrapper / chainer embedding all runtimes along with your own MSI file(s).
In other tools, you will have to do it yourself, by figuring out command lines and how to handle error conditions. There are some hints here (not tested by me - a google sweep will give you more): https://www.itninja.com/software/microsoft/access-runtime/2016-1
Get more command line info by going accessruntime_4288-1001_x64_en-us.exe /?:
WiX is free and open source - with a relatively hefty learning curve if you don't know MSI, and contains a bootstrapper feature called "Burn". Here is the documentation for: How To: Install the .NET Framework Using Burn (first read the "Building Installation Package Bundles" instructions in "Step 1"). A real-world Burn sample. And some sample source markup.
Some developers recommend the dotnetinstaller bootstrapper. Not something I know much about. It is just a bootstrapper. Runs things in sequence for you.
If you are doing in-house or ad-hoc deployment, even a batch file could do the job I suppose, but if you do that for a real product for large-scale and generalized deployment I would be very worried indeed. If there is one thing we hate as deployment specialists, I'd say it is batch files embedded in packages. Batch files (and scripts) are system administrator tools, not general deployment tools.
Some Older Links:
Executable files to MSI installer
How do Installation Software Programs Extract Files?
Create MSI or setup project with Visual Studio 2012
How to make an installer that automatically install all the prerequisite programs for the application
Windows service NOT shown in add remove programs under control panel
How to make an installer that automatically install all the prerequisite programs for the application
Wix - How to run/install application without UI

Visual Studio setup projects have a Prerequisites choice in the project's properties. This allows you to choose from a list of standard prerequisites and generate a setup.exe that will install the prerequisites and then install your MSI. The Access Runtime doesn't appear in later versions of setup projects because (I assume) Access 2013 ended mainstream support in 2018. The way to add your own prerequisites to this mechanism was with the Bootstrap Manifest Generator, which is perhaps still available but not well documented:
https://msdn.microsoft.com/en-us/library/ms165429.aspx
Apart from that I'd recommend that you learn how to build a WiX Burn bootstrapper executable that will install the Access Runtime and then install your MSI (which you still build with Visual Studio if you need to). If you do a search for that you'll find this kind of thing:
WiX - Install Prerequisites and 3rd party applications
https://www.c-sharpcorner.com/UploadFile/cb88b2/installing-prerequisites-using-wix-bootstrapper-project-and/
These will explain how to build the Xml to check whether the Access Runtime is installed and the command to use to install it. This is a much better choice than the Bootstrap Manifest Generator.

Related

Is it possible to modify the UI of an MSI created with Microsoft Visual Studio Installer Projects?

I have created a setup project with Microsoft Visual Studio Installer Projects, everything works fine, registry keys, post build event etc .. but is it possible to modify the UI of the installer? for example add a background image, change the font of the characters?
The UI of the current setup look like this
Visual Studio installer project is a limited tool that may not provide this sort of customization capabilities. Some properties should be supported, though, through the "Properties" panel of your installer in Visual Studio.
You can also edit the generated installer, there are tools to edit MSI files directly (like InstEdit or Orca for example). But this is quite time consuming, and probably more suitable for one-time job and not for a continious development process.
If you want to customize your installer to the maximum extent possible for MSI format, you better pick some other tool for creating MSI, like WiX Toolset for example or Advanced Installer. Alternatively, if you are okay with .EXE installer and don't necessarily need MSI, you can also pick NSIS or Inno Setup for example (looking at the category of free tools). Something like that could spare you some time you would otherwise spend on learning the internals of the MSI.
I am not familiar with the VS installer project. But I can recommend the Wix Toolset .. it is extremely flexible.. sometimes too much), but there you can build you r own screens quite easily.

Windows service NOT shown in add remove programs under control panel

I installed my windows service via (name of the service: Testing Service)
InstallUtil.exe present in .NET Framework
(:\Windows\Microsoft.NET\FrameWork64\v4) in a windows 7 computer.
I can see my service under services console.
However, i went to programs and features of control panel to manually uninstall the same service, i didn't see my services under programs and features?
Any thoughts why a service will not be shown, so that, user can
uninstall it?
I checked the show hidden files too, but still service not shown?
InstallUtil.exe: As others have stated, InstallUtil.exe is intended for development use only, not for final distribution of your service.
MSI: The normal way to deploy services in the fashion you describe (with a proper entry in add/remove programs) would be to use an MSI installer created using a tool designed to help you do so (it is not advisable to "roll your own" tool to do this).
Ad-Hoc: The ad-hoc description of deployment tools below was written in a hurry, and has sort of been re-purposed as a general description of
such tools. Not too relevant for the question asked, but it sort of "happened" and here it is.
Free MSI Tools / Viewers
How can I compare the content of two (or more) MSI files? (towards bottom) - (most of) these are not full-featured tools to make setups, but great to inspect MSI files and to create transforms.
MSI Tools: Short-List
There are many tools you can use for MSI-creation, for example (arbitrary order - links to Stefan Kruger's installsite.org below will show further tools, these are just the most common ones):
WiX - quick download
Free, open source framework - excellent, but with a learning curve, hence a few more links.
WiX quick-start tips (a bit chaotic, strangely upvoted, must be helpful).
WiX's commercial branch FireGiant has a WiX expansion pack (which costs money).
Windows Installer and the creation of WiX (what is the idea behind WiX?).
How to install and start a Windows Service using WiX.
Documentation: ServiceInstall, ServiceControl.
Untested: How to create a Windows Service MSI Installer Using WiX.
IsWiX - quick download
Deployment and MSI expert Chris Painter has his own, free WiX-based tool called IsWiX
It can help with WiX's learning curve and manage WiX source files.
Also see his IsWiX Tutorials.
The various ways used (and abused) to install Windows Services.
Advanced Installer - quick download
Great commercial tool with lots of smarts to help you deliver packages quickly and reliably.
Some free features.
Here is a great gateway to all things Advanced Installer.
installing services, how-to.
InstallShield - quick download
The old and established market leader tool Installshield features a very rich set of functionality capable of delivering advanced setup requirements.
There used to be a Lite version which cost money at one point. Not sure if it is available now.
There is an InstallShield Limited Edition version. Unsure of its feature set and cost (if any). Does not work with Visual Studio Community editions.
Installing, Controlling, and Configuring Windows Services.
PACE suite - quick download
https://pacesuite.com/support/
https://pacesuite.com/docs/v5.5/how-to/edit-mgp/services/index.html
Visual Studio Installer project type
There is also the Visual Studio Installer project type in Visual Studio (VS 2017 sample).
I would not really recommend this - especially if you have advanced deployment or automation requirements.
It is very basic, and there are many severe limitations.
Install the Visual Studio setup and deployment project template.
Auto-Update?: Various ways to create auto-updating packages.
MSI Tools: Comparisons and Descriptions
What are the above tools like in actual use? Here are some pragmatic observations and summaries:
How to create windows installer (recommended overview).
What installation product to use? InstallShield, WiX, Wise, Advanced Installer, etc (an aging, detailed comparison of these major MSI tools - very detailed and "pragmatic").
Deployment Tools (General)
There are many further tools available to create create installers / setup.exe files of various kinds (not just MSI tools, but general purpose, legacy tools, multi-platform tools, etc...):
Stefan Kruger's Comprehensive Lists:
Non-MSI installer tools: http://www.installsite.org/pages/en/tt_nonmsi.htm
Windows installer tools: http://www.installsite.org/pages/en/msi/authoring.htm
Sys-admin tools: http://www.installsite.org/pages/en/msi/admins.htm
Other Links:
Cross-Platform Installers: Does an universal cross-platform installer exists? (non-MSI tools).
dotNetInstaller: There is also the dotNetInstaller Setup Bootstrapper - which I have never used.
Here it is on github.com (source).
Just a bootstrapper (runs things in sequence for you, and then some), not a development tool as such. I find this tool "a bit weird".
Some General Links: And there are various other ways to deploy - for example with self-extracting zip archives and stuff like that. Not recommended, but some links:
Error Creating a 7-zip installer package (7-Zip, iExpress and other self-extractor creators)
Combine exe and msi file in one installer (recommended)
Visual Studio 2017 Installer Project - include VC++ 2015 Redistributable (WiX Burn Quick Start)
Additional Setup in Visual Studio Installer Projects
InstallUtil only performs actions exposed by your .Net Installer classes, such as registering a service.
It does not perform the "standard" application installation which results in the entries being added into add/remove programs.
To do this, you will need to look at various install builders such as Wix, Installshield, etc.
Installutil.exe (Installer Tool)
The Installer tool is a command-line utility that allows you to
install and uninstall server resources by executing the installer
components in specified assemblies.
Its job in life is to do exactly that,
To fill in your knowledge you should read through this
Chapter 2. Install/Uninstall
You will notice this is an entirely different concept, and actually has all the information you need (albeit in a very verbose manner)
There are various ways to achieve what you are after, one of them is using out of the box installation software, MSI, click once, or many others. or you could roll your own by using the above resources
There is a Microsoft Visual Studio 2017 Installer available via Tools->Extensions and Updates
This official Microsoft Extension provides support for Visual Studio Installer Projects in VS2017
Because I cannot make and edit the most interesting answer, I will add it here:
NSIS Installer - quick download
NSIS (Nullsoft Scriptable Install System) is a professional open source system to create Windows installers. It is designed to be as small and flexible as possible and is therefore very suitable for internet distribution.
Free and open source
Used by WireShark (source of Wireshark installer)
Example tutorials

Wrap C# application in .msi installer

I have created a C# application in Visual Studio 2017. Now I would like to distribute my application as a single windows installer file.
I was hoping for a simple one-click solution (select all the files I want to include -> voila! there's the installer). But it seems to be not that easy :-(
I often read that Visual Studio supports setup projects. But that does not seem to be the case anymore, right?
Third party tools are either very complicated (e.g. Wix, Inno Setup) or very expensive (e.g. Advanced Installer).
Is there really no simple way to wrap some files in an .msi Windows installer?
Does Microsoft provide no tooling to create such installers?
At one point, Microsoft did remove the "Visual Studio Installer Project" support from Visual Studio1. And then they later relented and added support back. I can't remember which versions didn't have support, I think it was 2012 and 2013.
These days (for VS2017), to get the Visual Studio Installer Project support, you add it from the marketplace:
This extension provides the same functionality that currently exists in Visual Studio 2015 for Visual Studio Installer projects. To use this extension, you can either open the Extensions and Updates dialog, select the online node, and search for "Visual Studio Installer Projects Extension," or you can download directly from this page.
Personally, however, I'd go with WIX. It does have a learning curve but I think it's learning worth doing.
1For what I personally see as very good reasons. You had to have a full-blown install of Visual Studio to make them work, they didn't really integrate with MSBuild, which makes them a pain if/when you want to move to automating your builds.
VS Installer Projects: Several good answers already - worth trying out. As stated by others you can use Microsoft Visual Studio 2017 Installer Projects - as limited as they are (bullet list form). They feature some pre-requisite functionality as I recall. I have limited experience with the tool. Could work for something very simple, but you will quickly discover limitations.
WiX: Personally I would use WiX since it is also free and flexible - it takes some effort, but is very capable. Here is a WiX quick start tip answer (frankly not my favorite answer, but it has been upvoted more than usual and updated frequently - hopefully it still has its essence of helpfulness).
IsWiX: There is also IsWix - a GUI tool to help create WiX setups (Chris Painter's work). His WiX tutorials and a quick youtube demo.
Et Al: The commercial tools (Installshield, Advanced Installer (see Bogdan's answer in this "thread"), PACE Suite, etc...) are also good - your time costs too. Can be shocking once you add it up - and you will definitely get running quicker with a commercial tool. How to create windows installer (links to pretty comprehensive lists of tools and some MSI information). Further links below.
Other than that, I'll just link to a few pre-existing answers with info about various tools:
Quick review of different MSI tools
What installation product to use? InstallShield, WiX, Wise, Advanced Installer, etc
or very expensive (e.g. Advanced Installer).
There is a also a free edition which includes a Visual Studio extension for Advanced Installer, which you can use to build MSI packages.
The following tutorial shows how you can use the features from the free edition ("Simple" project type):
https://www.advancedinstaller.com/user-guide/tutorial-ai-ext-vs.html
https://www.advancedinstaller.com/user-guide/tutorial-simple.html
P.S. I work on the team building Advanced Installer.

Application Installer: Microsoft database engine 2010 not available under pre-requisites

I have a windows form c-sharp application developed for windows 10. When I am trying to make installer, I cannot find "microsoft database engine 2010" (important for my app) under the "prerequisite" as shown below:
I do not want my customer to separately download it and install it. So is there a way I can generate an installer that will install complete software along with microsoft database engine 2010 ( if it is not already installed on the system) ?
I have never used this runtime, but did you do a Google search? It looks like the runtime is available: https://www.microsoft.com/en-us/download/details.aspx?id=13255. I am sure you did. Perhaps it is the wrong one? Or a format you can't use I guess.
The downloads are x86 and 64-bit versions in EXE format. The EXE files have embedded MSI files (Windows Installer) that you can extract, or you should be able to just run the EXE in silent mode (probably safest). Do a AccessDatabaseEngine_X64.exe /? to get a list of parameters.
Merge Modules
Normally you can use a merge module to add a runtime component to your own MSI at compile time, but this runtime may not be available in this format. Instead you can use a bootstrapper of some kind to run your own MSI installer and this prerequisite database engine runtime MSI / EXE in sequence (or even just a batch file - see towards the bottom).
Bootstrappers
The WiX toolkit (which is a better way to make MSI files than Visual Studio Installer Projects - see the link for some details) features a bootstrapper called Burn - it can install both EXE and MSI files in sequence. There are also other bootstrappers available, but I haven't tried them. Here is a description of some bootstrappers from earlier: Wix - How to run/install application without UI.
As you will see in the link immediately above, there is a sample of the WiX bootstrapper Burn in use here: https://github.com/frederiksen/Classic-WiX-Burn-Theme (it even shows a WiX MSI package as well). WiX and Burn does have a learning curve.
There may be simpler options available using Visual Studio Installer Projects that I am not aware of, but I think you need a bootstrapper to install several MSI files in sequence. As far as I can see these Installer Projects support only the listed prerequisites that you show in your screenshot to download and install on demand, and they seem to allow the addition of (any) standard merge module. It is very strange that you can't tell the Installer Project's setup.exe to kick off the install of any MSI as a prerequisite considering that the whole feature is made to install prerequisites in the first place. PhilDW will surely be able to tell you with certainty.
Commercial tools such as Advanced Installer or Installshield also have features to allow you to bundle setups, in various formats, together for installation in sequence. It might be a feature in the Premium or most expensive edition in Installshield's case. Not sure for Advanced Installer. Bogdan Mitrache will be able to tell us - they may do it better. I don't want to claim something I am not sure of - things like these change as new versions are released (may obviously also be the case for Installshield).
Batch File, PowerShell Script
In closing I should add that you can obviously use a batch file to install files in sequence (or a PowerShell script - which would depend on .NET though). For example wrapped in a self-extracting archive. You can quickly try the built in iexpress.exe self-extracting tool in Windows: Hold down Windows Key and tap R, enter iexpress and press Enter. Click through the options. Be very aware of the security vulnerabilities iexpress suffers from!
Not sure how well well these wrappers clean up their temporary files (particularly if there are errors during installation) - which could be ugly and annoying, but it should work. A bootstrapper can do a lot more though - such as provide a real GUI for your users and handle error conditions among other things.
Security problems with deployment solutions is a pet peeve of mine, so I want to add a link to this: Prevent DLL Hijacking Burn with Clean Room. A WiX Burn issue fixed in the latest version of WiX (as of Jan.2018). As you can see, the allure and simplicity of iexpress.exe generally does not make up for its security shortcomings. It is most definitely not good enough for a world-wide, large-scale, public release.
Should you want to use a batch file or PowerShell for the installation, then the following answer provides some information on using the msiexec.exe command line, and there is also a link to another answer which deals with PowerShell installation: How can I use powershell to run through an installer?

Installer for C# App

I'm developing an open source C# application. For awhile now, I've been using a basic .NET installer I coded myself. However, with a recent change, that is no longer practical for me, as I'd have to add a large number of files to the installer - and they may change with each release. A ZIP file is also not practical.
I've done some checking online, I see a lot of MSI, ClickOnce, Self-extracting ZIPs, and (imo the most promising) the NSIS system. None of them seem to exactly fit my needs, so I'm looking for advice on which system to use.
Actual installing of my program is very simple. Basically, I just need to copy the bin\Release directory (and all subdirs) to the client's computer. I've been achieving this somewhat ad-hoc, by embedding every file in my .NET installer, and maintaining a file table of what goes where.
Unfortunately, I just localized my app. I now have 30+ .resx files (Which are compiled to dlls and placed into MORE subdirectories by Visual Studio) and, obviously, it's impractical to add 30+ folders and DLLs to my installer. Hence why I'm on this search.
There's also a few other requirements:
The installer should search predefined directories for a specified .exe. (My app is designed to be a drop in replacement) If the .exe is not found, it should prompt for its location
The installer should verify that "OldApp.exe.bak" exists. If not, it should rename "OldApp.exe" to "OldApp.exe.bak"
The installer should update files. Ie, if "Culture.de.dll" hasn't changed, the installer will leave it alone.
The installer should work with all Windows versions of all .NET IDEs (VS, SharpDevelop, Mono, ect) but does not need to work on other platforms.
When I build the solution, the installer should be automatically regenerated. In other words, it should be run-able for by "Post-build" section.
The installer generation must be able to be added to a source code repo. This is so that anyone who downloads the source of my app can compile the installer as well.
Sorry for the long post, I figured it was better to post more than less.
I'd recommend SharpSetup. It combines WiX and C# for a pretty flexible implementation. Not much I've found it can't accomplish.
We use WIX extensively: http://wix.codeplex.com/
You may have to customize your installers with some exit routines to do things out of the ordinary, but there are hooks in Windows Installer framework that let you do that.
You can put these definition files (XML) in your source control, and you can configure a build to execute the installation. However, anyone that gets your source would need to have the WIX utilities installed.
I would recommend NSIS. From my experience any installer feature that I have required has been covered in NSIS documentation or community examples. I can't comment on NSIS integration with Visual Studio as I use NSIS integrated with my Jenkins build server. There appears to be a free Visual Studio Add-In called Visual & Installer which provides NSIS integration with Visual Studio. I have not personally used it but it appears to be currently actively developed so might be worth checking out.
WIX is a good one. According to Wikipedia, it is used by Microsoft to produce installers for some of their own products.

Categories

Resources