How to resolve “'installutil' is not recognized as an internal or external command, operable program or batch file.”?

后端 未结 12 1698
情话喂你
情话喂你 2020-12-07 08:41

Just tried to run an application via the following:

\"enter

I have browsed to

相关标签:
12条回答
  • 2020-12-07 09:09

    Unless you've modified your path, the following should be available in developer command prompt and not cmd:

    • msbuild
    • mstest(for ultimate)
    • csc
    • ilasm

    ... etc

    If those aren't available you may have a corrupted install.

    0 讨论(0)
  • 2020-12-07 09:10

    According Microsoft Page :

    If you’re using the Visual Studio command prompt, InstallUtil.exe should be on the system path. If not, you can add it to the path, or use the fully qualified path to invoke it. This tool is installed with the .NET Framework, and its path is :

    %WINDIR%\Microsoft.NET\Framework[64]\

    For example, for the 32-bit version of the .NET Framework 4 or 4.5.*, if your Windows installation directory is C:\Windows, the path is :

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe

    For the 64-bit version of the .NET Framework 4 or 4.5.*, the default path is :

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe

    0 讨论(0)
  • 2020-12-07 09:11

    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) {
            var 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 Service1() 
            };
            ServiceBase.Run(servicesToRun);
        }
    }
    

    Then you can just call WindowsService1.exe with the --install argument and it will install the service and you can forget about InstallUtil.exe.

    0 讨论(0)
  • 2020-12-07 09:14

    This is what I have done to make it go away:

    1. Found where installutil resides on my PC. In my case it was C:\Windows\Microsoft.NET\Framework\v4.0.30319

    2. Opened a command prompt as an Administrator and changed current directory to above: 'cd C:\Windows\Microsoft.NET\Framework\v4.0.30319'

    3. Then entered: 'installutil C:\MyProgramName.exe'

    Interestingly, prior to above solution I tried different options, among them adding C:\Windows\Microsoft.NET\Framework\v4.0.30319 to the System Path variable, but it still could not find it.

    Wish you all smooth installation.

    0 讨论(0)
  • 2020-12-07 09:18

    open visual studio command prompt in admin mode i.e., right click on vs command prompt and run as administrator

    0 讨论(0)
  • 2020-12-07 09:23

    InstallUtil.exe is typically found under one of the versions listed under C:\Windows\Microsoft.NET\Framework.

    In my case it is under v4.0.30319.

    You could just check your path:

    echo %PATH%

    should give you a list of directories searched for executables.

    0 讨论(0)
提交回复
热议问题