How to install windows service using Inno Setup? - c#

In VS2010 I have solution with windows service project and some other 'helper' projects. So in my debug folder there is an windows service application and couple of dlls.
I can install windows service by running application with parameter, so in Inno Setup I just do:
Filename: {app}\MyService.exe; Parameters: "--install"; WorkingDir: {app}; Flags: skipifdoesntexist; StatusMsg: "MyService is being installed. Please wait..."
My question in: It is necessary to pack all files from Release folder to my Setup file? I mean, in my Release folder are: DLLs from my other projects in app solution, Program Debug Database (.pdb) files, and XML Configuration file..
What files should be packed in my Setup.exe file?

You just need the *.exe files.
*.pbd and other are not needed there.
Only DLLs if nedded by your main project (service).

Related

Exception in deployment, not when run from Release folder (JSON File Missing)

C# .NET 6.0 WinForms x64bit Desktop application
Application exe runs fine via the project's "x64\Release" folder.
We deliver via an MSI created via "Setup and Deployment Tool". When the application is installed via the MSI file, the user gets an exception as the application launches.
System.PlatformNotSupportedException: System.Management currently is only supported for Windows desktop applications.
at System.Management.ManagementBaseObject..ctor(SerializationInfo inf, StreamingContext context)
I've tracked this down to a difference in the file: MyApp.deps.json between the "Release" folder and the installed destination "Program Files" folder.
If I copy that "Release" .json file to the "Program Files..." location, the application runs fine.
What's going on with the Setup and Deployment MSI creator? How can I fix this?
Runtime Configuration Files:
MyApp.deps.json - A list of dependencies, compilation dependencies and version information used to address assembly conflicts. Not technically required, but required to use the servicing or package cache/shared package install features, and to assist during roll-forward scenarios to select the newest version of any assembly that exists more than once in the application and framework(s). If the file is not present, all assemblies in the current folder are used instead.
So you'd better have it deployed with your application.
Regarding the issue. Do you use publish profile? Please check if you specified it in PublishProfilePath, as described in Visual Studio Installer Projects Extension and .NET 6.0
Also you can check what do you have in you publish folder and try to configure the publish profile to have everything you need there.

Won't run .exe correctly on Windows Server

I'm trying to run a Console Application on Windows Server 2019 (x64).
After i run .exe on the server then writes the following error:
Could not load or assembly 'MySql.Data'
..etc for all dependencies.
I tried to run just the .exe file (i didn't copy the whole Release directory) on a few PC and it is working well. All of them Win 64bit.
On the server, .exe only work if i copy the whole /Release directory.
I also build and release app with 'Any Cpu' option.
Any tip why i need to copy the whole /bin/release directory to run .exe?
Why not enough just the .exe file?
Many thanks!
The exe file doesn't contain the used dlls, just references to the dlls. That's why they are in the release directory and the reason you need to copy the whole directory.
Kind regards
Bernd

File getting copied to SysWOW64 instead of System32 while installing INF thru Installer

We have INF file which installs one .sys file to windows drivers folder. Scenario is as follows:
1) Installing the INF from File Explorer. Right click on INF file and click on Install. In this scenario .sys file gets copy under Windows\System32\drivers folder.
2) Created console application to install using RunDll32 / CMD under process object and install the INF file. In this scenario .sys file gets copy under Windows\System32\drivers folder.
3) Created x86 installer program having installer class to install using RunDll32 / CMD under process object and install the INF file. In this scenario .sys file gets copy under Windows\SysWOW64\drivers.
Our objective is to copy .sys file under Windows\System32\drivers folder irrespective of 32/64 bit flavor windows operating systems like WinXP, Windows7, Windiows 8/8.1/10.
Windows Installer (MSI) installs insist on installing 32-bit components in an x86 setup to the 32-bit locations. Attempts to direct 32-bit files to 64-bit locations will result in redirection. A 64-bit install can install to both.
Different MSIs are required for different architectures:
https://blogs.msdn.microsoft.com/heaths/2008/01/15/different-packages-are-required-for-different-processor-architectures/
and see in particular the WIN64DUALFOLDERS log and the accompanying remarks.

How to setup System.Data.SQLite.dll

Have I an application using sqlite...
Ive tried this:
installing via ClickOnce Application setup (it works)
I Put SQLite.dll file together with .exe in the same folder. (it works}
hmm the folder with an .exe only (not working)
What I mean is when you build the project and get the .exe on the folder \bin\Debug and move it somewhere then when you run the app errors will not occurs.
I wondering if there's a way that i can run even without installing ClickOnce Application setup?
I thinking of setup the SQLite.dll on specific path reference? Is it possible to do that?
-thanks
System.Data.SQLite.dll is not part of the standard .NET Framework so it does not get installed in the GAC of the client machines when .NET runtime is installed at first.
that's the reason why you should have this dll referenced by your executable, distributed together and in the same folder as your exe is deployed.
or you could distribute it somewhere else like in a sub-folder of your application setup and have proper entries in the configuration file or in the .NET C# code to specify where assemblies not found in the standard locations have to be loaded from.
You can use Nuget to get the package installed. For my case, it automatically created 2 subfolders for me, which is x86 and x64, I just followed the folder structure in the bin folder, and it worked fine for my case.

Change Application Folder Path of Windows CE Setup Project

I've created an application for Windows CE and I'm trying to create a setup project. I'm doing a silent update operation and need to install the .CAB files to a specific folder (\Program Files\abc\xx)
By default, it installs to \Program Files\Product Name
How can I make it to install on \Program Files\abc\xx ?
This was possible for windows installers but I guess not possible for Windows CE installers.
Thank you
You have to modify the INF file that CABWiz is using (specifically the InstallDir in the CEStrings section).
If you're using the Studio project that wraps this INF file, then you can't adjust it (one of the many shortcomings of the device CAB installer projects).

Categories

Resources