We are going to release an application developed using C# and now recently we faced a problem building set up application using Advanced Installer 15.6.
To put it in more detail we are going to one to install .NET Framework 4.6.1 in silent mode (with no window).
We tried to find the solution for several hours and also asked Advanced Installer team, but haven't find or receive any answer.
Tried as followings.
/q
/quiet
...
Hope to receive quick answers.
Do you launch the setup package elevated, for instance by using Run as admin , or as a child process within an elevated process? If the setup package is not launched elevated the prerequisite installer will fail to install silently from what I know.
Related
I am using Visual Studio Community 2022, and I was wondering if you could use another CLI to run/debug a c# console application. (I can't use cmd.exe or powershell because it's blocked by the admins of the device I'm using). Git Bash would be preferred, because it's already installed. Thank you!
Edit: Looks like you can't do this. dotnet run just tries to open the blocked binary, no matter where you run it. I think the admins hate everyone though because they allow you to install lots of things (like Unity, vscode, etc.) but running anything just doesn't work.
Thanks for trying everyone!
use this to run your program in CLI but you cannot debug it if you want to debug use debugger mode of vs2022,
If it's a framework-dependent application (the default), you run it by dotnet yourapp.dll.
Run the project in the current directory:
dotnet run
check Microsoft Docs dotnet run for more options.
CLI: Use Vs2022 Terminal in View->Terminal it may help You to run it.
I have a .Net 5 console application that I am trying to run as a Windows service. I have followed all of the articles online on how to do this and have it completed successfully (ie: using BackgroundService). The question is, I want to have an MSI installer to deploy this and all of the articles I have read about creating a service in .Net 5 instruct me to install the service manually using a command prompt or power shell and issuing the "sc" command.
Back before .Net 5, I could use the built in Visual Studio Installer extension and simply create an MSI that would deploy and install my service. I can't seem to make that work for .Net 5.
Is it still possible to use the built in Installer extension to deploy and install my .Net 5 BackgroundService?
Thanks!
Installing Services: There are many ways to install services, you should use an MSI package and the built-in mechanisms there to install and start the service and stop and update it during upgrades.
Various ways to install services (with links to samples on how to install services using MSI).
Learning WiX: Please see the WiX section here - the links should get you started. Direct link to the main WiX link list.
Links:
Windows Services Frequently Asked Questions (FAQ)
Installation package created with WIX Toolset does not remove program folder + files on uninstallation
How to install a system service without permission errors
I have created installer(exe) using clickonce which provides GUI for installing my application.
Now I wanted to make this installer to run silently from commandline by taking some of the arguments from command window. Arguments may be like database server name, user id and password etc.
This silent installer should also take care of pre-requisites that I have mentioned for GUI based installer. There is .Net Framework v4.7.1, VC++ 2017 and windows installer v4.5 are my pre-requisites required to be installed onto the target machine if they are not available.
I have tried to read arguments from program.cs Main method, I am now able to fetch argument and able to run installer command line without issue on the machine where my pre-requisites are installed already.
There I have no clue on running .net fx, VC++ and Windows installer from silent installer. Because my installer is not launched because of no prior .Net fx is installed there.
My expectation is to run .Net fx, VC++ and Windows installer before running my installer from commandline window.
Inno Setup (https://jrsoftware.org/isinfo.php) has support for "Running other programs before, during or after install." so you can launch other installers and wait, here is how to install MSI files (you can download and distribute them with your installer):
https://jrsoftware.org/iskb.php?msi
Here are the install parameters that are required for silent installation (you can make a SilentSetup.bat file and execute that):
/SILENT Runs the installer in silent mode (The progress window is displayed)
/VERYSILENT Very silent mode. No windows are displayed.
/SUPPRESSMSGBOXES Suppress message boxes. Only has an effect when combined with '/SILENT' and '/VERYSILENT'.
/NOCANCEL Disables cancelling the installation process.
/NORESTART Prevents installer from restarting the system even if it's necessary.
/DIR="x:\dirname" Overrides the default install directory.
I have used VS Setup projects (no longer supported out of the box), Install Shield (for advanced dialogs during install), ClickOnce (at my employer, which is a pain and can fail by no fault of your code but windows config) and Inno Setup.
Unless you need features that Inno Setup doesn't have, I recommend you go with it, you could also perform custom tasks with either scripting or executing an Exe:
https://jrsoftware.org/iskb.php?custom
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 have followed this blog for deploying my WPF application. I used windows installer technology classic setup project template in Visual Studio 2015.
I am using windows installer instead of ClickOnce deployment because I need to choose my own installation path and custom wizard UI.
But there is not information regarding how to update my application when I use windows installer to deploy my application. How can I update my app after once it was installed in clients machine? Are there different possible ways to achieve this?
It would be helpful if anyone can provide the resources or suggest any practical approaches that I can use to update my WPF app.
In Visual Studio setups you use the RemovePreviousVersions project property. This should help:
https://www.simple-talk.com/dotnet/visual-studio/updates-to-setup-projects/
Basically just increment the setup project version, accept the changes, keep UpgradeCode the same, set RemovePreviousVersions to true.
The project's properties window is shown when you select the setup project in Solution Explorer and use F4, or View=>Properties Window, NOT property pages.
You'll also need to increment the file versions of files you wish to be updated.
If you want to do it silently, use the msiexec command line options that include /q, such as msiexec /I [path to your new msi] /q
However if your install requires elevation it will fail because silent really means silent, so the usual request for elevation will not be shown.