我在Console Application
中有一个Visual Studio Solution
项目。此应用程序在这里被称为Semplicity MyApplication.exe,它不过是WCF服务的宿主。
我需要安装程序才能在目标计算机上安装我的应用程序,因此我下载了Microsoft Visual Studio Installer Projects
扩展名。我收集了所有要复制到“应用程序文件夹”中的文件,但我希望安装程序甚至将我的服务注册为Windows服务。
为此,我导入了InstallUtil.exe
,如下图所示。我创建了嵌套的额外文件夹(Windows文件夹-> Microsoft.NET-> Framework64-> v4.030319),以反映目标环境的实际结构。
然后我在Custom Action
节点下像这样创建Commit
:
以及以下Arguments:
“ [TARGETDIR] MyApplication.exe”
我尝试了生成的设置,但我注意到所有文件都已复制,但未安装服务(我在MSC列表中没有看到它)。
因此,在我的问题下方:
App.config
包含KeyValue [Server =“ localhost”],则可以在安装时通过弹出窗口向用户自定义它:“您的服务器在哪里?”并根据提示信息更新我的配置文件由用户?答案 0 :(得分:0)
限制 :Visual Studio Installer Projects have many limitations(short version, Chris Painter)。
替代工具 :There are many other tools, some of which are free。
WiX工具包 :WiX工具包是免费的开放源代码。这是两个无需运行定制即可安装服务的示例 操作(MSI内置了安装服务的能力,无需 使用
InstallUtil.exe
-the "say no" to unnecessary custom action campaign)
链接 :
答案 1 :(得分:0)
也许这对处于类似情况的人很有用。
使用声明
using System.Configuration.Install;
安装
ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location });
卸载
ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location });
以上内容处理了您提到的InstallUtil的功能。
文档
ManagedInstallerClass.InstallHelper
该实用程序位于以下位置:
Windows系统上的.NET目录:
InstallUtil.exe由Microsoft数字签名。