1

using code similar to this Inno Setup for Windows service?

on a windows 7 box (VS 2010) when I try to run my inno installer I get the following result

No public installers with the RunInstallerAttribute.Yes attribute could be found

The service works if run with a standard windows installer; here is the code:

[RunInstaller(true)]
internal static class Program
{
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    public static void Main(string[] args)
    {
        if (args.Count()==1)
        {
            string parameter = string.Concat(args);
            switch (parameter)
            {
                case "--install":
                    ManagedInstallerClass.InstallHelper(new string[] {Assembly.GetExecutingAssembly().Location});
                    break;
                case "--uninstall":
                    ManagedInstallerClass.InstallHelper(new string[]
                                                            {"/u", Assembly.GetExecutingAssembly().Location});
                    break;
            }
        }
        else
        {
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
                                {
                                    new SkyLibrarian()
                                };
            ServiceBase.Run(ServicesToRun);
        }
    }
}

Does anyone have any experience of this issue? I run the installer as an administrator using a right click. Thanks

Simon Norburn

Community
  • 1
  • 1
SimonN
  • 383
  • 1
  • 2
  • 13
  • Did you try to change "internal static class Program" to "public static class Program" ? – gandarez Aug 22 '11 at 13:24
  • Yes - just tried it again with the same results. The exe name has no spaces so it isn't that either (Q4856403). Simon. – SimonN Aug 22 '11 at 13:48

2 Answers2

0

The problem is clearly stated in your error message and your pasted code. The error states that there is "No public installers with the RunInstallerAttribute.Yes attribute could be found". In your code snippet you declare your Program class (with the RunInstaller attribute to true) as internal.

Change your class declaration to public and it should work correctly.

[RunInstaller(true)]
public static class Program
Joshua
  • 8,112
  • 3
  • 35
  • 40
  • When you recompile is your installer using the latest binary? You should check just to make sure. Also, use a tool like [ILSpy](http://wiki.sharpdevelop.net/ILSpy.ashx) to look at the compiled code to ensure your program class is public. – Joshua Aug 22 '11 at 19:25
0

This was a simple error. The ProjectInstaller file had become corrupt and removed from the solution. It had been intended to replace it but someone 'forgot'. Once that was found the issue resolved itself. The error message was not descriptive nor helpful.

SimonN
  • 383
  • 1
  • 2
  • 13