Unique .exe file in visual Studio, C# desktop application - visual-studio

I have C# desktop application created in Visual Studio.
I need to have one executable file, which I can run anywhere. Without compiler or need of having folders of libraries. The .exe file I have in project folder doesn't work alone.
Thanks

Create installable file using any third party software i.e Advance Installer to send your project anywhere.

If it's a .NET application executable then YES you can send it anywhere and run it anywhere having just one file; provided the fact that wherever or whichever machine you are trying to run it; have .NET Framework installed.
Else, you should create a self extracting installer which will not only include the executable but also will have the framework executable. That way wherever you run the installer will first install the framework and then you can run your exe without any trouble.

Related

How do I compile a UWP application to a stand-alone EXE file?

I have a UWP application. I can run it inside of Visual Studio by using the Run button. I also know how to create an App Package and distributed it via App Center.
What I can't figure out how to do is build an EXE file that I can run on my own computer without launching Visual Studio (or copy to another computer). I found the EXE in the project folder under bin/x64/Debug (or bin/x64/Release), but it won't run. In fact it does nothing when I double-click on it.
What am I doing wrong?
The easiest way I have found to get apps installed on computers for non-technical users is to give them the output of that Create App Packages submenu, which includes a ps1 script and certificate file. If you give it to them as a zip make sure they unzip the whole folder first, and run the ps1 script from the unzipped folder. If Developer Mode is not enabled on their computer, the settings dialog to enable it will open automatically, and they just have to flip the switch. Otherwise, they are just pressing Y or A in the PowerShell window to continue through the installation process.
It's not too bad, the whole thing takes about 30 seconds if you breeze through it, but I believe you need admin rights on the computer you're installing on, there's a UAC prompt at some point.
I found the EXE in the project folder under bin/x64/Debug (or bin/x64/Release)
The exe file is the uwp executive core, but it could not run directly, because it has some dependencies need to be packed together, so we need use Visual Studio to create package for your app. And this document contains detailed steps you could refer.
After getting the installation package, we need the side-load, and please note:
If you are not publishing your app and simply want to sideload an app package, you first need to trust the package. To trust the package, the certificate must be installed on the user's device.

How to create a multi setup project in Advanced Installer

I’ve two MSI files that I want to be installed in one setup installation.
One is an application – EXE file and the other is a windows service that will start and stop the EXE file.
So, EXE file setup needs to be installed before the windows service.
First I create a project for the EXE file that generates a MSI file. After I create a project to the Windows Service application that generates other MSI. So far so good.
If I install each file separated it works well.
But, I’d like to have just one setup to install these two applications,
For what I read it seems that I need to add the EXE project (MSI file) to the Windows Service application project.
I already tried to add it on Prerequisites page as a Chained Package or as a Feature-based, but only installs the EXE project. The Windows Service is never installed.
What mistake I’m doing?
This is not the correct way. You can modify the project that installs your EXE file, to also install and start the service.
Your project that installs the EXE now just contains the file in Files and Folders page. The new step is to go to Services page and add a new service installation.
The linked example from above is a for a Java application, but he same can be applied to any other executable file.

Can a ClickOnce project be configured so that downloaded file is called differently from setup.exe?

I'd like to make it so that when users click the "Install" button, the installer file they download to their local machine is called differently from default setup.exe, e.g. myCoolInstaller.exe. Is that even possible with ClickOnce?
A simple option is to use symbolic links. From the command prompt, whilst in your release folder type:
mklink myCoolInstaller.exe setup.exe
Then everytime you publish to setup.exe, your users can download using the more friendly name. Note that this does not update the publish.htm file - you will need to edit that yourself. In our case, we don't use it - we provide a link to our customers directly to the installer .exe
The setup.exe file that is generated by Visual Studio has very little to do with ClickOnce. It simply bootstraps your pre-requisite installs together and launches your actual ClickOnce app (the .application file) when it's finished.
You should just be able to rename it.

How to create my an installer for my DLL?

I am currently using Visual C++ to develop my DLL program. This DLL also uses outside executables inside my local hard drive.
When doing testing, I manually install the DLL using this command regsvr32 filename.dll at the Windows command prompt.
What I would like to do now is an installer, like the Installshield etc. So, after this I can easily install it on other Windows machines without the need to manually use the command prompt, copying those separates executables into the hard drive and so on.
Is there a way to do this the open source way? or Is it available inside Visual Studio? Need advice on best practice.
Another possibility since you're already using VS, you can create a "Setup and deployment project", found under "Other Project Types". This allows you amongst other things to select the output of another VS project (in the same solution), add registry entries, package files from the file system, and register (regsvr32) files. To register a DLL (once you have added it to the project), change the "Register" entry on the "Properties" Window to vsdrfCOMSelfReg. However if you're packaging other executables off the hard drive, I'm not sure how you would make sure that they run. You prob have to make sure that you package all their run-times and dependencies.
AFAIR this functionality is not available in the express editions of VS.
WiX is open source, and there's a free (no cost) version of InstallShield available for Visual Studio 2010, so both.

Why Visual Studio creates .exe installer files?

when I build solutions in Visual Studio, that generates installer files as .exe and .msi, .exe files are useful for what?
The .EXE file that is created by the installer project is a bootstrapper for the .MSI setup file. It is used to launch the .MSI setup file.
Generally, both will launch the setup program and allow the user to install the application. However, sometimes the setup.exe file will run a custom validation routine to determine if the user's computer meets the minimum requirements for installing the software.
For example, if the user does not have Windows Installer, they will not be able to launch the .MSI file, but the .EXE application will still run and inform them that they need to install Windows Installer first. For .NET applications specifically, the .EXE file verifies the presence of the appropriate version of the .NET Framework, and if it is not present, it prompts the user to download and install it.
You can customize the prerequisites that are required for your application in your installer project using Visual Studio. See these MSDN articles for details on how to do that:
http://msdn.microsoft.com/en-us/library/ms165429(v=VS.100).aspx
http://msdn.microsoft.com/en-us/library/7eh4aaa5(v=VS.100).aspx
Others have commented on the how (.exe bootstraps the .msi) but part of the reason why is that users know that .exe files are the things you run. I don't think your average user knows that .msi files are something that you can click on to install an application.
The .exe file is made for installing the prerequisites of your application.
Let's say your application uses the .Net 3.5 framework, you can tell the installer project to include the installation of the needed libraries if they're not already installed.
You may also deactivate it, so only the .msi is being created.
This page shows how to activate and configure the prerequisites setup, just uncheck the checkbox in order to deactivate it.
You also find more details on the process of Bootstrapping on MSDN:
the capability to automatically detect
the existence of components during
installation and install a
predetermined set of prerequisites
.exe files are useful for executing your programs that you've just built in Visual Studio, assuming you're not doing web applications.
Pretty much every Windows program out there is executed using files with an .exe suffix.
Installer exe files are normally just the msi wrapped in a bootstrapper. The bootstrapper can do anything, but normally its purpose is to ensure the user is running a sufficient version of Windows Installer, then extract the msi and invoke msiexec.exe to start installing the msi. Generating installers as exe's is deprecated these days, but some still do it.

Resources