Install Matlab MCR as part of the C# Installer Wizard - c#

I have wrote a program HelloApp with Matlab and packaged it as .NET Assembly using deploytool as described here. As a result I have got helloapp.dll library, which I included into my Visual Studio 2015 as a reference, so I can run Matlab methods directly from C#. To run the code without Matlab installed, the end user needs Matlab Runtime (MCR) installed at least.
Now I want to create an installer for my C# program. I have came across Visual Studio 2015 Installer Projects which provides some tools to create program setup wizard. The problem is, I don't know how to include download and setup of MCR package as a step in installation process to ensure the user has all the required prerequisites in order for program to run.

Well this is not really an answer, but comment area in question was too short ...
I don't know much about VS2015 Installer as I personnally use innosetup. Anyway to check if runtime is installed on target machine you can look if following key exists in the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\MathWorks\MATLAB Runtime\9.0
See my posts here and here for further details.
NB1: Note that installer for Matlab runtime is very large (about 1 GB). I would not package it with application to deploy, but just warn the user to install it separately.
NB2: I think Mathworks is packaging C:\Program Files\MATLAB\R2015b\toolbox\compiler\deploy\win64\InstallAgent.zip (~66MB) rather than MCRInstall.exe (~1GB) when deploying standalone installer with deploytool for downloading the runtime during install but I don't know how it works.

Related

Visual c++ libraries

I'm currently working in VS2017 on a solution with multiple C# and C++ projects.
The installer project has the C++ redistributable as a prerequisite, with the option to download it from the component vendor's site.
Some of the clients want to be able to install the application without an internet connection.
The normal thing would be to put the package in the bootstraper and check the download from the same location as my application; the problem is every time Microsoft updates something with this library, compiling the application would work, but installation will have the old redistributable.
Is there any check to include Visual Studio libraries that are used when building the application, which ever version these may be?

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?

Install Shield msi file installing to the wrong directory (error 1309)

I am using Visual Studio 2013/ISLE to create a C# program with a .msi install image. When I run install from VS the program is installed in the expected location, e.g. c:/Program Files (x86)/...
I'm sure that this is something simple but I can't figure it out. A pointers would be greatly appreciated.
When you run a 32-bit installer in x 64-bit system Windows will always redirect your installer writing to c:\Program Files to c:\program files (x86). If you want to install to the non-x86 folder you will need to provide a 64-bit installer for your application.
This blog post explains why Windows does this.
It looks like InstallShield LE will allow you to write to the correct folder when your project is set to AnyCPU, but for more advanced scenario's you'll need to use the Pro version or the free Wix installer.
I assume the question is why the installation MSI fails when you run it outside of Visual Studio, but works when VS launches it?
If yes, you should first check if your ISLE project is creating an MSI or an EXE bootstrapper (that also contains the MSI). If an EXE is created this is what you should launch manually, not the MSI. In theory, a bootstrapper can act like an initialization support for the MSI and specify default values for certain properties, like an installation folder, etc...
I say in theory because I am not very familiar with ISLE, I work with other setup authoring tools, thus cannot say for sure if this stands for ISE projects too.

C# Missing MSVCR100.dll

I'm developing an app that execute another app and I received this error:
the program can't start because MSVCR100.dll is missing from your
computer
with my C# app, can I fix this problem copying this .dll into windows/system32 folder?
Or exists another method to do this?
This links below point to the proper downloads for the MSVCRT100 installer. This is likely what you want your customers to run before installing your app. This will properly install the MSVCRT DLLs in the proper directory such that all applications can use it.
Microsoft Visual C++ 2010 Redistributable Package (x86) (probably what you need for 32-bit and 64-bit os)
Microsoft Visual C++ 2010 Redistributable Package (x64) (Only if your app itself is 64-bit)
If you actually want to install the MSVCRT100 DLLs through a merge module within your own MSI - you can link your MSI to the MSMs that are located in the x86 version your "c:\program files\common files\merge modules" directory" (Assuming you have Visual Studio 2010 installed).
C:\Program Files (x86)\Common Files\Merge Modules>dir *CRT*.msm
Volume in drive C has no label.
Volume Serial Number is 60A4-1718
Directory of C:\Program Files (x86)\Common Files\Merge Modules
04/22/2011 01:18 PM 584,192 Microsoft_VC100_CRT_x64.msm
04/22/2011 01:41 PM 571,904 Microsoft_VC100_CRT_x86.msm <-- This is likely the MSM you want if your app is 32-bit.
04/22/2011 01:14 PM 847,360 Microsoft_VC100_DebugCRT_x64.msm
04/22/2011 01:39 PM 801,792 Microsoft_VC100_DebugCRT_x86.msm
Two other alternatives:
Instead of copying MSVCRT100.dll into a system directory, copy it into the directory of the EXE app you are trying to launch that depends on this DLL. This isn't recommended, but won't run the risk of breaking other apps.
Another alternative. If you actually have the source code to the EXE that you are trying to launch, you can completely bypass all of this "install msvcrt100.dll" noise by just statically linking to it. In visual studio, it's the option in the project's propery dialog under C/C++ (under the Code Generation tab). Change "runtime library" from "Multi-threaded Dll" to just "Multi-threaded". This adds the /MT compiler switch.
Whatever program you're trying to start has to be properly installed first. Msvcr100.dll is one of the DLLs that need to be deployed for programs written in C or C++ with VS2010. It is simple with a Setup and Deployment project or by building the program with the /MT option. Contact the program owner for support.
what is missing is the Visual C++ runtime.
are you starting a C++ application from your C# code? if so, make sure the proper runtime is available on the client machines.
You should be able to fix this by copying it and registering it (with command line: regsvr32 "DLLNAME") or you can ship it with your executable and it should work
WARNING: Please consult the following article before including the file with your software... http://msdn.microsoft.com/en-us/library/ms235299.aspx
I take no responsibility for your actions

What C++ packages do i need to run a program?

I created a C# application that uses a C++ dll and im trying to create an install package that will allow this to run on other computers whether they have VS or not, the problem is i don't know what C++ libraries i need to let it do this. When i run just the application on a blank virtual machine it says
" xxxx has encountered a problem and needs to close."
If i go and download visual studio 2008 express version and install it on the machine, the my program will run fine. problem is express is 85-185mb to download and 335mb up to 1.1gb to install on a machine, the program that is using it is only 33kb. huge overhead there...
if i install just the C++ redistributable from msdn site, it takes up 4mb, but it wont let me run my program.
what packages from C++ do i need to make this program run on a blanked computer?
That question can be tough to answer. If you have the source of the c++ dll you should be able to see its dependencies unless the person used a lot of com or load library calls. One of the best tools I used to get c++ depencany info was depends.exe. One thing to check if its your code is that you are not using debug version with dependencies on debug dll that I think are not in the redistributable.
caleb, I recommend you a program called Dependency Walker. It will show you all the dll dependencies you have. I'm sure there are much more of them for Windows but that's the one I've been using for quite a while and I like it. So you did right by downloading the redistributable package from the MS web site but your app probably depends on some other libraries. When I tried to build my installer long time ago using Visual Studio I remember it was a way to include a redistributable package in your installer or use side-by-side installation - depending whether the license agreement of your Visual Studio version allowed you to do that or not. Also you could include all the dll dependencies you have in the installer.
Hope that helps
The C++ runtime dlls you need are the ones provided with the compiler as redistributable package and exactly this one! Other redist packages won't necessary work because of the manifests embedded in the executables which require an exact version (checked by a hash value of the binaries in the side by side assembly directory C:\Windows\SxS)
So you are right with the redistributable but you need the one that was installed with the compiler not one from a best guess from the internet. The exact versions can be looked at in the manifest files (XML)

Categories

Resources