Fully custom application installer - c#

At the moment I have written my own installer that copies files from resources or downloads them online
I know about things like wix, etc., but I have specific requirements:
Have only one window, the user selects (if he wants) the installation folder and a list of pre-installed plugins that the installer downloads from the application's plugin store.
This window has an interactive animation that uses a lightweight render engine
And as I said, it's completely ready, the application uses C# and does everything as it should, except that the installer requires administrator rights and falls under the radar of antiviruses
That's my question, how do I solve these problems? Do I need to request elevation to administrator, as well as somehow add the installer to the whitelist? Perhaps it needs to be signed somehow?

Related

Is there a way to install several ClickOnce apps's setups in one go?

I have made a WPF application that launches other published WPF app setups whenever their corresponding buttons are clicked by using System.Diagnostics.Process.Start() and specifying each of their setup.exe locations (example: D:\Publishedapps\app1\setup.exe).
And it works as Intended because Windows knows to just launch it if its already installed.
But as it is right now the user has to click on every app individually to install/launch to use it, and each app runs its own install process asking for permission to install and all that jazz.
So I want to simplify it for the user by installing the user-selected apps in one go While keeping the launch functionality intact(when the icon is clicked on my app it launches). I think I managed to sort out the user-selected choices using a list.
But I'm stumped on how to install them in one go. I've looked up several other ways to make an installer like WiXSharp and VS's Advanced Installer. But I'm making my own installer as to not be bound by any tools. And maybe because of it, couldn't really find a good solution on the net.
Know any way to run the "setup.exe"s in one go?

attempt to write a read-only database sqlite Wpf inno setup [duplicate]

I am developing desktop database application. Using rdlc report and reportviewer. Everything was fine in developing process, reportviewer was showing all data smoothly. I deploy app with Inno Setup. But when I install the app, the reportviewer is not showing data. While data is correctly inserted in the tables.
For applications that work incorrectly or fail completely, when installed by Inno Setup to Program Files folder, the first thing to test, is to try to deploy the application manually to the same folder.
If the application fails even after a manual deployment, the most usual problem is that the application requires a user to have write permissions to application folder. As on modern versions of Windows a user typically does not have write permissions to the Program Files folder, the application does not work. So the problem usually has nothing to do with Inno Setup, but it's a problem of the application itself.
To solve the problem:
The best solution is to redesign the application so that it does not require write permissions to its folder. Windows applications should not require write permissions to their folder. That's against Windows guidelines. The application should write data to a user profile folder (C:\Users\username\AppData) or to a common data folder (C:\ProgramData).
A dirty workaround is have the installer grant a user(s) write permissions to the installation folder. Do that only, if you cannot get the application fixed (e.g. it's 3rd party application).
See Inno Setup - How to set permissions of installation folder.
Even more gross workaround is to configure the application to be executed with elevated (Administrator) privileges.
See Inno Setup desktop shortcut (link) which has "Run as administrator" advanced property set
or How to set 'Run as administrator' on a file using Inno Setup.
Another solution is enabling legacy compatibility mode that makes Windows redirect all application write attempts to a virtual store. See also Application installed with Inno Setup writes files to unknown location instead of its installation folder.
There are numerous other possible reasons, why the application might be failing when installed, including:
You omitted some dependency:
DLL library
.NET assembly
.NET Framework
Java Runtime Environment
other runtime
COM/ActiveX object, etc.
The application requires some configuration:
a file
a registry key [including COM/ActiveX object registration]
an environment variable, etc.
The application is not designed to be executed from a folder that has a space in its name (Program Files).
The application gets confused by Windows File virtualization (though it's unlikely). See Application installed with Inno Setup writes files to unknown location instead of its installation folder.

Visual Studio 2017 c# setup project configuration file path

I have created a windows service application in C# which uses an SQLite database file to store data it receives. I want to be able to allow the user to select the directory the SQLite database file is stored on their PC during installation. How can I do this, and how can the main application obtain the file path chosen by the user?
The only folder that Visual Studio Setups (and most others too) let you choose is the Application Folder that defaults to Program Files.
It really isn't worth doing what you ask because:
Why make the user choose a folder and complicate the setup with stuff to tell the app where it is?
What if the user chooses a folder that apps cannot access if you want to allow limited users to run the app? Or a location that makes the install fail?
It's better to just choose the most reasonable working location that you can thoroughly test with the app, and that's AppDataFolder if it's private to the app. That's User's Application Data Folder in the setup project file system view.
https://learn.microsoft.com/en-us/windows/desktop/Msi/appdatafolder
Then the app automatically knows where it is and everything just works.
VS setups don't support what you're asking, other tools do, but, again, usually setups just install files to the appropriate folders that make the app work. By the way, custom actions won't do this because all VS custom actions run after the files are installed.

Create outlook addin without need for admin rights

I wrote an outlook addin with some basic functionality to access a webservice and execute methods on it. Everything works like a charm, except that I can't seem to get rid of the fact that users need admin rights to install this add-in. Google doesn't really seem to have the solution or answer for me,.
Is it possible to write an outlook addin (VSTO) which users can install without the need of admin rights?
Thanks a lot in advance!
It depends if you want a Per-User install or a Per-Machine install.
The main difference is where the registry keys are saved, under HKLU or under HKLM:
The other main difference is Per-User is set by default to install in the Users folder and Per-Machine is set by default to Program Files.
As #Aron mentioned certain prerequisites may require admin rights to install. If you know the client has the correct .Net version installed its possible. Otherwise you might need to resort to running the VSTO Add-In without .Net. Note: Microsoft Info path is written entirely in .Net so if users have the full office install, .Net 2.0 (maybe more recent depending on the version) should already be installed.
The easiest way to avoid the UAC prompt is to run the MSI not the setup.exe. Because the setup.exe is responsible for the downloadeding/installing components (such as dotnet). Running the MSI wont ask for admin.
Also note the MSI command line usage to see all the switch's (eg /quiet):
Start > Run > CMD > Enter
c:\Apps\App1\Release\app.MSI /?
I know this is really old, but there still isn't much help available this process.
One possible solution if your only goal is to share your project with someone and not specifically "install". I'm sure there are some issues with this method, but it is really simple, and so far it is working for my teams simple project. Additionally my team is not allowed internet access on their development machines and that complicates the standard publishing process.
Publish the project. (this is for VS2017 yours may be different)
Build the project. I built in release mode, but debug may work.
Publish the project.
Right click on your project in the solution explorer and choose
properties.
Select the publish tab.
make sure publishing folder location is "publish/" (or more generally a relative file path)
click publish now
Next we need to add it directly to someone's office program. You can add it directly by
opening options under the file menu
Go to the Add-Ins tab
Make sure "Com Add-ins" is selected in the drop down and click the "Go..." button
Once the dialog box opens click the "Add..." button
Navigate to "/bin/release/app.publish/" and choose the setup.exe file.
Restart the Office program.
Your vsto add-in should now be added in.
The answer is yes and no. In of itself, it is possible to install a VSTO plug in without admin rights via ClickOnce.
However, certain prerequisites may require admin rights to install (such as dotnet).
So in the general case no. But it maybe possible.

Creating a "sure to run" app / installer in VS2010

I need to create a simple installer of sorts for a different application. That other application already has it's own simplistic installer, and I don't want to meddle with it.
The reason for my own installer is to allow the user to install SQL Express if (s)he so chooses, and also to pre-install any other basic requirements for such a procedure.
At the moment, here's where I'm at:
I've created a single Windows form application, with big buttons (this is for a user which likely won't be very good with computers) to install SQL Server Express (using silent install with a predefined set of arguments) or the actual application, along with some helpful text to let the user know what's going on. Something along the lines of Visual Studio autorun window.
I've also added the standard set of pre-requirements to the application (.NET, Windows Installer).
Everything works OK if I run the app by using the executable. HOWEVER, if I publish it to create a ClickOnce application (so the pre-requisites are installed when needed) and run it, it stops running other installers.
EDIT: Apparently the problem with not being able to run other application from a ClickOnce application is only on my end, and probably deserves a new question, not necessarily here on StackOverflow (perhaps on MSDN forums?).
In your program before launching the installer you can check if .NET is installed. Its pretty easy to check if a particular s/w or a version of s/w is installed. Write a program that will check HKEY/LocalMachine/Microsoft/Windows/CurrentVersion/Uninstall and in that there will be list of programs that have been installed on that machine. If you find then go ahead with your install else suggest user that he needs to install pre req.
When you create a setup project you can right click on the setup project, go to properties, and click on pre requisites. In that you can mention which version of .NET framework is needed and then give the location of the framework. In this link look for Huggy Bears response eggheadcafe.com/community/aspnet/2/10131905/setup-project.aspx
I've settled for a "Click Once" application. It can install all required .NET components needed for it to run, thus becoming an "sure-to-run-non-native-C++-code-splash-screen".
Granted, there ARE issues with Click Once, but this is far better than nothing. It's also better than running C++ or unmanaged code applications. ;)

Categories