1

I have developed a WPF application in Visual Studio 2017 & need to create a setup installer for the same.

I need few additional feature :

  1. During installation, the applicaiton should reserve some ports which can be used in future for hosting any WCF Services or WebAPI.

  2. After the installation is completed, the application should be configured in a way that it should always run in administrator mode.

  3. It should download some fonts package on system while installation of project/exe file on desired machine. Fonts Package i can download from https://www.1001freefonts.com/ or anyother site.

Pls. let me know how to proceed with this. With Template of 'Setup Project' in VS 2017, i can create an exe of my WPF applications but how to add above 3 features, i have no idea.

** If Visual Studio'Template - 'Setup Project' or 'Setup Wizard' don't support these above features, then I can use anyother third party installer... Pls suggest.

Thanks, Happy Coding.!

Codec
  • 21
  • 1
  • 4
  • No, That was also posted by me... but didn't receive any answer.. Waiting for quick response... – Codec Dec 16 '19 at 08:38

2 Answers2

2

I strongly recommend "Inno Setup" - it's powerful, very easy to use, and free!

  1. Not sure what you mean by reserving ports, but if it's something that is done via a command prompt then InnoSetup has the ability to issue commands during an install. It also has a built-in scripting language for more complex scenarios.

  2. Setting a file or shortcut to run as administrator is possible (see here).

  3. ttf font files can be installed using the FontInstall argument (here). If you really have to download the font then again you might be able to do something with a batch file or script.

Andrew Stephens
  • 9,413
  • 6
  • 76
  • 152
  • I have to second this recommendation. After DAYS wasted trying to get Windows Application Packaging Project or Visual Studio Installer Projects to work (both fail miserably out of the box for all but the most ridiculously simple 'Hello World' apps), Inno Setup is like a breath of fresh air. Simple and elegant. – rmirabelle May 06 '22 at 19:15
1

For question #0 (how to create an installer) see https://github.com/iswix-llc/iswix-tutorials (Desktop Application Tutorial)

For question #1 use the WiX firewall extension. (Add a reference to firewall extension DLL and add additional markup to XML generated in step 0 following this example http://www.joyofsetup.com/2008/05/17/new-wix-feature-firewall-extension/)

For question #2 This isn't a function of the installer. You need to add an application manifest to your WPF project with a requireAdministrator tag. This will cause your application to request elevation whenever it is started.

For question #3 Normally you'd just author these files into your installer. This seems to be skirting around redistribution rights and thus I can't really provide comments.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • 1
    Nice summary. I hope we can eliminate applications that run with admin rights *"just to get running"* without fixing what is wrong with them. *"Running with scissors"* these elevated apps- possibly used to spawn any number of other elevated processes if they are hacked by existing or emergent vulnerabilities. Shocking how long we ran with *"access all areas"* in Windows. – Stein Åsmul Dec 16 '19 at 18:02