如何解决"“installutil”不被识别为一个内部或外部命令,可操作的程序或批处理文件" ;?。 [英] How to resolve "'installutil' is not recognized as an internal or external command, operable program or batch file."?
问题描述
只是试图通过运行以下应用:
Just tried to run an application via the following:
我已经浏览到该目录与应用 WindowsService1.exe
在它,然后试图命令 Installutil WindowsService1.exe
,但得到了以下错误...
I have browsed to the directory with an app WindowsService1.exe
in it, then tried the command Installutil WindowsService1.exe
but got the following error...
由于VS只被安装一天或二:我担心的东西可能是错的安装,因为它应该承认installutil。
As VS has only been installed for a day or two I'm worried that something may be wrong with that install as it should recognise installutil.
是否有一些基本的诊断,我能保证VS命令提示符发现所有的程序,它应注意什么?
Are there some basic diagnostics I can perform to ensure that VS Command Prompt is finding all the programs that it should ?
修改
如果我运行 PATH
在命令提示符中我看到以下内容:
If i run PATH
in the command prompt I see the following:
推荐答案
这是一个稍微有点偏离主题,但我已经使用InstallUtil安装我的服务停止。这是很容易只是将其添加到服务本身。一个参考 System.Configuration.Install
添加(未提供的客户端配置文件版本,如果我没记错的话),然后更新您的Main() - 函数中的Program.cs这样
This is a tiny bit off-topic but I've stopped using InstallUtil to install my services. It's is really easy to just add it to the service itself. Add a reference to System.Configuration.Install
(not available in the Client Profile editions if I remember right) and then update your Main()-function in Program.cs like this.
static void Main(string[] args)
{
if (Environment.UserInteractive)
{
string parameter = string.Concat(args);
switch (parameter)
{
case "--install":
ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location });
break;
case "--uninstall":
ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location });
break;
}
}
else
{
ServiceBase[] servicesToRun = new ServiceBase[]
{
new Service1()
};
ServiceBase.Run(servicesToRun);
}
}
然后,你可以叫 WindowsService1.exe
与 - 安装
参数,它将安装的服务,您可以约 InstallUtil.exe <忘记/ code>。
Then you can just call WindowsService1.exe
with the --install
argument and it will install the service and you can forget about InstallUtil.exe
.
这篇关于如何解决"“installutil”不被识别为一个内部或外部命令,可操作的程序或批处理文件" ;?。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!