Show MessageBox on double-click - C# - c#

I have created the installer exe file using BA using wix.I want to force the user to open the exe as RUN as Administrator.To do this,I want to show a MessageBox with OK button to user if user double-click or right click and hit->Open.On clicking OK button on MessageBox should Exit the installation.I don't want to open the installer until the user open the file as Run as Administrator.
I want to know
1.Is the above behaviour is possible in wix using custom action or something.
2.Is it possible to detect exe double-click and right-click->Open in c#.
Update:
I have bundled all my two .msi using Wix bootstraper application into single EXE file.
One msi is with per user context which uninstall a application with per user context and install own.
second one is with per machine context and this also installs the files in windows drive.I have bundled both MSI as single EXE.
Now if i open the EXE as Run as Administrator,the EXE is uninstalling the per user package and installation happens successfully. If i directly double click the EXE package, during the removal of per user package i am getting the following exception "Error 1001.An exception occured during uninstalling....->Requested registry access is not allowed". and installation failed.
I tried adding a manifest file in Post Build of BA to include in to EXE package to prompt the administrator privilege during double click. After doing this and building in VS2010, all other two package are not included in EXE file and if i double click the EXE it is showing the UAC and close without installing.
Is any way there to include the two msi and manifest file in bundle.wxs
Thanks

Related

C# .msi Installer Creation without <My Exe Name>.exe.config

When I create .msi file for C# windows application, the file <myexename>.exe.config automatically comes in the installation path after installing the .msi setup file.
How to exclude .exe.config file?
I think it is to be done during the Set up creation process itself.
Please advice.
<myexename>.exe.config is a config file (App.config) of your application.
when you create installer for any windows application, it will autometically include it.
it is necessary, for example you stored your application database connection string in that or may be other settings also
so when you execute your application then your application myexename will look into <myexename>.exe.config for some settings as well for some necessary data required.
still, if you want to exclude it, perform the following steps:
1)Right click on installer project -> View -> File System
2)In Application Folder, Right Click on Primary Output of your application and select Properties Window
3)In Properties, Select Exclude Files
4)Click on Add Filter
5)Enter app.config in text and press ok
now rebuild your project and install the .msi
<myexename>.exe.config will be removed from your installation directory

Unable to install or run the application....in Desktop Application

I had developed a Desktop Application in .Net. I had published and deployed it in my Client's System. But while my client running that setup, an error message is displayed :
Unable to install or run the application. The application requires that assembly Microsoft.SqlServer.Diagnastics.STrace Version 10.0.0.0 be installed in the Global Assembly Cache (GAC) first
What should I do for this ?
Open project Properties form Solution explorer in visual studio
Properties->Publish -> Application Files
In Applications Files window check Show all files at the right bottom. change publish Status of "Microsoft.SqlServer.Types.dll" "Prerequisite(Auto)" to Include click ok and publish Application.
Probably, this dll is not present in Global Assembly Cache.
you can add an assembly to GAC by following command:
GACUTIL –i <Path to Microsoft.SqlServer.Diagnostics.STrace.dll>
to find if STrace.dll file is present on your client computer, you can search it with this command line:
dir Microsoft.SqlServer.Diagnostics.STrace.dll /s
if the file is found, use the previous anwser command line to add the dll to the global asembly cache
If not, you have to add this file as prerequisit in your deployment project
if you have a setup project (lik installshield / MS setup project / Clickonce project, the prerequisit can be added on your setup project properties.
when you add a prerequisit, you should be able to choose if the prerequisit has to be packaged with your application or downloaded from the publisher site.
What solved my problem was I had to do what #ShahidRaees did except include all of the assemblies. I selected all of them except for the file ending in .pdb.
Selecting all of them should automatically update the GAC when you install the program, but I'm not 100% sure.

Setup Project msi builds+ claims successful install, but no output

As per the title, I create a msi installer and then run it and it claims to have successfully installed and if I look in the control panel to add/remove program it appears there. However, when I look in the directory I specified, there is no change made to it. Nothing is copied into it.
When I run the installer and click the button to create a new directory and choose that new directory to install into, I get no errors. It all runs fine, but after exiting the installer, this new directory is not created.
I follow these steps to create my msi installer:
Open Visual Studio and open the project I wish to create installer for
File-> Add -> New Project -> Setup Wizard
Select "Create a setup for Windows Application"
Select "Primary output from (project)"
Add additional file -> path to txt file
Finish setup wizard
Look at Application Folder for setup
Right click primary output from (project)
Click outputs and verify it is correct
Build the setup project
This outputs the .msi file along with the .exe file. There is no problems/errors running either of these. It just doesn't install/copy the files.
Ok, so it was a privileges issue when double clicking the .msi file.
It would run fine and claim to install successfully but it didn't create folders/copy stuff in etc. It needed admin privileges to install.
So, to give it the privileges I edited the .vdproj file that created the .msi file (edited in notepad). I went to the MsiBootstrapper section and changed "RequiresElevation" = "11:FALSE" to "RequiresElevation" = "11:TRUE".
More information can be found here: http://msdn.microsoft.com/en-us/library/2kt85ked.aspx
I'm still not completely happy with this, it requires double clicking the .exe file which gives the UAC prompt to get the .msi file to run with the required privileges. It seems very easy for a user to just double click the .msi file and believe things to have installed...

Passing installation path via command line - installshield

I have this installation file setup.exe that was created with installShield wizard.
as part of the installation the user needs to prompt the installation path,
now i don't have any access to the installshield environment i can only run the setup.exe
file.
I want to activate the installation process via the command line in silent mode,and i need
a way to transfer to the setup.exe (via command line arguments) the installation path.
is there any way for me to do so ?? (msi installtion enables this option)
Thanks,
Liran
This depends mostly upon what kind of installation is behind the setup.exe you are installing. If it's a Basic MSI, you can pass MSI properties within a /v"..." parameter, and chances are good passing /v"/qn INSTALLDIR={path}" will be what you want. However if it's an InstallScript project, you'll need to record a .iss file, and include it to run silently.
See http://kb.flexerasoftware.com/doc/Helpnet/installshield15helplib/IHelpSetup_EXECmdLine.htm for details.

how to deploy my application?

I want to deploy my application. i followed this step but i can't get the .exe file. steps:
Step I:
Create one Windows based application in VS.Net using any of the Languages i.e. C# or VB.Net.
Step II:
After your program is running and you are ready for the setup. To add setup to your existing application go to Go to File > Add Project > New Project.
After your program is running and you are ready for the setup. To add setup to your existing application go to Go to File > Add Project > New Project.
The window appears like below and you select the Project as Setup Project and give a Name and its Location.
Step III:
After creating setup project right click on project and than select view, it will show different possible operations, which you can perform with this setup project.
The options available are
File System
Registry
File Types
User interfaces
Custom Actions
Launch conditions
Step IV:
Click on File system, it is used to create file system on the target machine. Through this you can specify what details you want to provide at the target machine.
Step V:
Now in the new window, its time to add the files & folder’s used by the application.
First we add the Project Output file. Click on Project Output and a new popup appears. Select the appropriate choice. For a normal project we select as Primary Output File & Content Files.
it is used to create file system on the target machine. Through this you can specify what details you want to provide at the target machine.
To add Icons/Any specific folders, click on Add > Folder and Folder is added. Rename the folder as per your project requirements
After the Folder is create then add the files to the setup. These will be installed in the same fashion on the target machine
Step VI:
Now we are about to create the setup before that we will setup the program icon. To do it we will do this process :
When you click on Browse, a window gets popup. Now as the icons are already added into the application setup, just click on Browse to pint to that icon and click on ok.
Step VII:
Now final step is compile the setup project. After compilation you will notice that it has generated Setup.msi in the same location which you provided when you initially created the setup project.
You can supply this msi the target machine, when you run this msi at target machine it will create a virtual directory as well as create same folder structure, which you have specified in File System. This installer will also install the specified those libraries in the registry which are specified in the Registry.
Now you can browse that application at the target machine in same way as you have done at your own machine.
What I could understand is, you have got some problem with deploying the EXE file.
This is the best tutorial I have ever seen for creating EXE or MSI files:
http://balanagaraj.wordpress.com/2007/05/29/create-exe-or-setup-file-in-net-windows-application/

Categories

Resources