Transfer data from msi installer to the installed exe - c#

I am trying to preform silent install to a windows servies via msi file and i want to transfer data at the installation to some config file(text file) that serve the exe windows service that the msi install.
The silent install command that i am executing is :
msiexec /u Installer.msi /q
When the msi installation is finish i call (automatically) to the "after install" event of the project installer and i want to build a txt file with few configuration for the windows service, one of the configuration parameters need to be inserted at the msi like ip address for some server.
Hope you get the idea and what i am struggling with..

Related

Can an AppX installer for an application remove an older installation of the application installed using an MSI?

I have installed my Hello World application using an MSI that I created for it. I've since converted the MSI installer to an AppX installer. Is it possible for the AppX installer to detect an existing installation of my Hello World application installed by the MSI installer and remove it, much as a standard MSI upgrade installation would?
I try to sideload one app in local machine twice, and I find when you sideload this app for the second time, the Appx installer can detect an existing app and remove the previous installation.
But it may not remind you that this app has been installed, and it doesn't also ask you that you wan to remove this app to reinstall or not, it just removes this app and reinstall app.
Update:I think it is impossible for the Appx installer to detect an existing installation of your application installed by the MSI installer and remove it. I install appx and there is no any detection information , and it will not remove the application installed by MSI installer

Install service to server 2012

I developed new service using .net 4.0 c#, I want now to install to hosting server which does not contain visual studio command promot and installUtil.exe . How can Install the service to the server? It is required to install the VS version ?
Go to "C:\Windows\System32"
Right click on "cmd.exe" and "Run as administrator"
And run "InstallUtil.exe" like that:
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe" "C:\src\Service.exe"
The first parameter is the full path of InstallUtil.exe
For 64 bit executables use following:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe
For 32 bit executables use following:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe
The second parameter is the full path of Service.exe to be installed.
I find the solution :
1- copy 'InstallUtil.exe' file to c: dirve in the server.
2- copy to the service execution file to same place.
3- open command promot in 'administrator mode'(run as admin)
4- write the following command : c:\InstallUtil c:\serviceName.exe
Note : ensure that the service and Installer are both 32-bit or 64-bit
I suggest you a small refactor to implement the whole service using Topshelf and you'll be able to install your Windows services with no additional tool than the service executable itself.
For example, yourexecutable install, yourexecutable uninstall, yourexecutable stop, yourexecutable start...

How to build Windows 8.1 app for Store (appxupload) in PowerShell?

Typically when I want to build Windows 8.1 or Windows Phone 8.1 app for Store I open Visual Studio 2015 and in Solution Explorer I start Store -> Create App Packages.. wizard.
I'd like to be able to produce identical signed .appxupload packages using PowerShell ideally just providing the target project file, target platform(s), build configuration and version number.
There is a page for packaging and deployment, but I just don't know what is the proper command order to use. There must be a simple solution for this standard task, right? Note I got Windows 10 and Visual Studio 2015 Pro installed, so all prerequisites should be there.
And a bonus question, is it possible to run Windows App Certification Kit on this created package as well from PowerShell?
Thanks
After log of digging I found the answer myself.
After associating the Project with Store and building app for Store using the Wizard and saving all changes it's then possible to build the store package again calling just 'msbuild' with the project/solution in a parameter.
I've described it in detail here:
https://www.suchan.cz/2015/09/building-windows-store-appxupload-packages-using-powershell/
These commands work with VS2013 on a W8.1 machine and a W8.1 project. I haven't been able to verify them with VS2015/W10 yet. I suppose they should work, as long as the required W8.1 SDK is installed.
"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\makeappx.exe" pack /d "<BinDirOfProject>" /p "<BindirOfProject>\output\project.appx" /l
"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\makecert.exe" /n "CN=tom" /r /h 0 /eku "1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.13" /e "01/01/2020" /sv "<BinDirOfProject>\output\key.pvk" "<BinDirOfProject>\output\key.cer"
"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\pvk2pfx.exe" /pvk "<BinDirOfProject>\output\key.pvk" /pi "<Pwd>" /spc "<BinDirOfProject>\output\key.cer" /pfx "<BinDirOfProject>\output\key.pfx"
"C:\Program Files (x86)\Windows Kits\8.1\bin\x86\signtool.exe" sign /fd SHA256 /a /f "<BinDirOfProject>\output\key.pfx" /p "<Pwd>" "<BinDirOfProject>\output\project.appx"
certutil -addStore TrustedPeople "<BinDirOfProject>\output\key.cer"
You will be prompted to enter a private-public keypair when creating the certificate (makecert.exe, you can ofcourse use an existing certificate).
<Pwd> is your private key for this certificate.

Silent Installation of MSI file while Main MSI file Installing

I created a windows forms project, and created a MSI file to install that windows application into client machine.
While Installing that MSI file, I check If the user using windows xp then I download a MSI file from internet and installing it in programatically using C#.
Since both files are MSI, so I am getting the following error.
Image link for the Error
http://i.stack.imgur.com/9A6WW.png
I am using Installer class in C#. Installing that file by overriding the Commit function.
How can I successfully Install that ?
Put the second installation in the prerequisites of the first. If second is unavailable then first it will install that after that your main program.

execute code just when install the application using installshield

I am just wondering if it is possible to run a small code just once when the application is installing.
I would like to create a registry with the installation path. The reason why I need that because I have a windows service in my application as well, which install path always changes to system32.
I have an ini file which is created in the installation folder at installation. I need to reach that file with my service and windows form as well.
You don't need any extra code, just create a registry key in HKLM\software\yoursoftware-here with a key name like Installpath and a value of [INSTALLDIR] in your install, then reference that key in your service.
This assumes you are using a basic MSI project in install shield.

Categories

Resources