Visual Studio Setup Project - check for directory existence - visual-studio

I am attempting to install a library DLL using a Visual Studio Setup Project in VS2010. The installer must install the DLL into the Target Application folder, as well as install the DLL into the appropriate folder for each instance of MS SQL Server Reporting Services installed.
i.e. if SQL 2008 reporting services is installed, then the DLL should additionally be installed to [ProgramFiles64Folder]\Microsoft SQL Server\MSRS10.MSSQLSERVER...\bin.
If SQL 2012 Reporting Services is also installed, then the DLL should also be installed to [ProgramFiles64Folder]\Microsoft SQL Server\MSRS10.MSSQLSERVER...\bin, etc.
I am trying to only install the DLL into the appropriate folder, if the corresponding version of SQL Server is installed on the system.
I have tried using the Registry Search, to look for the MSRS*.MSSQLSERVER key, but those keys aren't added to the Wow6432Node, and I couldn't find a way to get the installer to look only in the 64-bit node (built for Any CPU and x64--both ended up looking in the Wow6432Node).
I also tried using a File Search, but couldn't get this to work when looking for the existence of a directory rather than a file.
Is there any simple way to do this determination? To only install a file to a target folder if said target folder already exists?

Setup projects that generate MSI files (Windows Installer) don't do directory search, just file, registry, and installer component guid search. If you knew the installer component guids of representative files from those setups you could search for those with the Windows Installer search and have a property set that tells you whether they are installed or not.

Related

Setup has detected that vcredist_x64\vc_redist.x64.exe has been changed since it was initially published

I've been trying to make an installer for an exe file, yet I can't seem to get it work. Whenever the setup.exe is run, it errors with the message
Setup has detected that C:\Users[name]\AppData\Local\Temp\VSD4F7F.tmp\vcredist_x64\vc_redist.x64.exe has been changed since it was initially published
I attempted to make it download from the same location as my PC, but that too didn't work as when it was building the solution it errored saying that the files were not found. I put the right files in the Packages folder, yet it still didn't work.
For reference, I'm using a 64 bit PC to develop, the exe was designed for 64 bit, and the clean PC that I'm testing on is 64 bit. I'm also using Windows 10 and Visual Studio 2019.
I have the same issue, and I found sort of a workaround:
It seems that when installer creates bootstrapper (the setup.exe) it embeds information from C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\vcredist_x64\product.xml. More precisely, it seems to embed the public key of the vc++ redistributable in the setup.
When user runs the setup, bootstrapper downloads the vcredist from Microsoft's web (in my case https://aka.ms/vs/16/release/vc_redist.x64.exe) and checks the digital signature. If the public key of the downloaded file doesn't match the embedded one in setup, you get the error.
Now, I managed to fix it (sort of) by manually editing C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages\vcredist_x64\product.xml putting the downloaded vcredist public key into the xml file and rebuilding the installer project.
However, if Microsoft again changes the signature on vcredist, my setup will start throwing errors again.
It is driving me insane. I'm considering:
a) removing the prerequisite from my installer and instructing users to install vcredist
themselves
or
b) Hosting vcredist on my own website (and checking "Download prerequisites from the same location as my application)
Both of these solutions have significant drawbacks and yet, updating setup each time Microsoft releases "new" vcredist is not an option either

visual studio setup project updating at same location?

How can I ensure that the msi installer (created using visual studio installer project) installs the application at the same location where its previous version was installed ?
So for example the scenario is this.
User install the app using myapp-v1.msi installer at c:\program files\myapp
Now I fix a bug and create a new version of installer myapp-v2.msi
When the user installs myapp-v2.msi it should install at c:\program files\myapp (perhaps not giving the location choice to user)
I want to do that because I have data files present in the previous location and I want that new files go in the same location so that it picks up data files from it's current directory.
Thanks,
That should be done automatically, as default behavior in MSI packages. Have you tested it?
However, you should know that keeping data files next to the installed files is not recommended, nor standard practice. If these data files should be available to all users you should store them in CommonAppDataFolder.

Modify visual studio's SQL Express Bootstrapper

I know there are ways of installing SQL Express from the command line. This link gives an example of that. There is another example in here..
When I make this change in my application:
then when I deploy my application and install it on a computer that does not have that prerequisite I notice that the installer downloads that prerequisite:
If I cancel the installation and then launch the exe file that the installer downloaded then I will see:
If I do not cancel the installer, I believe that the installer then goes ahead and installs SQL Server Express with a technique similar to the one posted by the first two links link 1, link 2.
Where does Visual Studio stores the parameters that are being passed to the exe that it downloads in order to create a silent install? will it be possible to modify those parameters that are being passed to the exe? also I know which file (prerequisites) did visual studio (installer) downloads because I found it on the computer when installing my application but how can I tell from what link does visual studio downloads the prerequisites? I know it depends on the OS version and architecture of the operating system where the application is being installed.
Anyways I am just curious about the last paragraph. In short, I just want to modify the parameters that are being passed to the prerequisites of SQL Server Express 2008. Those parameters should be somewhere in the application that I deployed. Or maybe they get downloaded from Microsoft.
On a 64-bit machine the SQL Server Express bootstrapper is typically located in the following folder:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\SqlExpress2008\en
Look inside the package.xml file for the command line parameters for the installer.

Deploying and setting up SQL Express 2008

Looking into installing an instance of SQL Express for an app. I want to have a separate installer. (I need to run some Transact-SQL stuff afterwards)
I've been referencing this article.
It is recommended that you ship the Express package extracted on your media and then launch Setup.exe directly. To extract the Express package, run the following command.
So far I tried bundling the unpackaged SQL Setup in an MSI (using a Setup and Deployment project). The user installs, which just puts the extracted files in a folder, then in OnAfterInstall I'm the setup process. This doesn't work since SQL's Setup.exe runs some .msi files.
Was able to make my own executable to bootstrap the installation and use FreeExtractor to create a self-extracting zip of the setup and my bootstrapper and then run my executable at the end.

Location of files from extracted installshield setup.exe

I have a Installshield Basic MSI project. This project uses Installshield's bootstrapper to install several setup prerequisites. Everything is bundled and compressed inside a single exe (Setup.exe). I have one prerequisite that needs to know the the full path of the file to execute. Is there a property available to find this path?
Or another solution. We are using Installshield 2008 with not much chance of upgrading at the moment. I am needing to install SQL Server 2008 which is dependent upon Windows Installer 4.5. Installshield 2008 doesn't have support for WinInstaller 4.5 so I created prerequisites for it for WinXp and Vista. I have WinXP working correctly.
However Windows Vista, the redistributable for Windows Installer 4.5 is a .msu file and needs to be executed through wsua.exe. I created a small app that just accepts the commandline params and kicks off wusa.exe with params to install the Windows Installer redistributable. However wusa.exe needs the full path to the redistributable. Is there a way to find the path to where setup.exe extracted the files?
Or is there a way to add support for Windows Installer 4.5 to Installshield 2008, doubt it, but it would be easiest
For your alternate approach with IS2008, you should be able to do this in your helper exe. Assuming you're using C++, you can call GetModuleFileName() to find the location of your running exe (other languages should expose similar functionality somewhere). Since all the prerequisite's files will have been extracted to the same folder, you can use this to figure out the full path for the .msu file as well.
Upgrading will get you direct support (as well as included prerequisites for Windows Installer 4.5) as IS2009 and later prerequisites shell execute their target, supporting .msu files natively. IS2009 and later also have support for a prerequisite command-line property which you could use to locate your prerequisite files; see the InstallShield 2009 Release Notes and search for ISPREREQDIR.

Resources