locked
Problem building Setup project for Windows Service RRS feed

  • Question

  • Using VS 2005:

    I have a project which is a Windows Service. I have a ServiceInstaller class in that project which installs the service.

    I have also created a Setup project for the service. Under Custom Actions, I've added to the Install folder "Primary output from MyService (Active)" and the same to the Uninstall folder.
    When I try to build the setup I get the error:
    Unable to build custom action named Primary output from MyService (Active), InstallerClass property is only valid for assemblies.

    I do I have to put the installer class in a separate project? I didn't think that this was a requirement for InstallerClasses. I thought that they could also be in your executable.
    Sunday, June 17, 2007 10:12 PM

All replies

  • Hi

     

    I'm not sure what's wrong but here's some links I found useful:

    A good Article

    http://www.codeproject.com/vb/net/WindowsServiceInstall.asp

    Creating a Windows Service

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbwlkwalkthroughcreatingwindowsserviceapplication.asp

    Setup Projects

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vbconSetupProjects.asp

    Custom Actions

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxwlkWalkthroughCreatingCustomAction.asp

    To Answer the question: No, the Installer Class goes in the same project as the Windows Service.

     

    I followed these to create my first Windows Service and Setup Projects back in VS2003 and have now migrated to VS2005. Hope they work for you.

     

    Regards

    Steve

    Monday, June 18, 2007 5:28 AM
  • None of these articles address the problem that I'm having. In addition all of the articles are about 1.1 Framework/ VS 2003. Try creating a service project in 2005, and a setup project in the same solution. Add your service assembly as custom actions on install and uninstall and see if you get the error.

     

    I think the problem is related to how I add files to the "Applications Folder".

    If I add the files by right clicking in the "Applications Folder" and selecting Add->Project Output. This adds an item called "Primary output from MyService (Active)"  I then add Custom Actions for Install and Uninstall which point to the "Primary output from MyService (Active)", then I get errors.

     

    If I add files by Add->Assembly and choosing the files out of the Release directories. i.e. MyService.exe and then Add Custom Actions which point to MyService.exe everything works fine.

     

    The problem with creating the installer by pointing to the exe files.

    Monday, June 18, 2007 1:53 PM
  • I experienced the same error you did and found this solution:

     

    The problem relates to how the projects is build. Try to explicitly build your 'MyService' first (right-click: Build). This will generate the required assembly file for the setup projects Custom action.

     

    To prevent it from happening again (after a Clean Solution), Project Dependencies will problably have to modified.

     

    /Jakob

    Thursday, June 21, 2007 1:21 PM
  • Jakob,

    Were you getting the error following error?

     

    "Unable to build custom action named Primary output from MyService (Active), InstallerClass property is only valid for assemblies."

     

    It didn't say that it couldn't find the assembly, it said that it was only valid for assemblies. I assumed that it was telling me that it couldn't run InstallerClasses from executables


    Thursday, June 21, 2007 2:53 PM
  • Set all the projects (solution) to "Release" vs "Debug" build.
    Thursday, August 14, 2008 11:17 PM
  • I had the same error message in my setup project.  I had two other projects referencing each other in the same solution.  My problem turned out to be that one project was configured to build its DLL for a x64 platform and the referencing project was configured to build its DLL for a x86 platform.  These values are configured by right-clicking the solution file in Visual Studio and choosing Properties to view the Configuration Properties (Project Contexts).
    • Proposed as answer by thundter Friday, November 15, 2013 9:45 AM
    Tuesday, November 11, 2008 11:54 PM
  •  

    I haven't been able to reproduce the problem. An .exe with a serviceInstaller class should work.  Does this reproduce in just one specific solution, or in all on your system?

     

    BTW, not related to your problem, but I do recommend adding the assembly to all custom action events, including Commit and Rollback.

     

    Wednesday, November 12, 2008 5:34 AM
  • I had the same issue and found the following,

    a) I was running the Build in debug mode
    b) Found a .tmp file in the bin/debug folder of the setup project folder.


    There was something in it that was referencing the active build of the project output that caused for the error. The following is what I did

    a) Remove the project from the solution
    b) Delete the .tmp file in the folder
    c) Add the project back into the solution.
    d) Rebuild and it worked.

    -- SUDHEER SAJJA
    Tuesday, February 3, 2009 4:14 PM
  • I had the same Problem, too. After migrating my Project from VS2005 to VS2008 the Setup Project rejected to build having the same Message as above.

    Davids tip did resolve my problem: Just deleted the old Setup project and created a new project was successful.

    Monday, February 23, 2009 9:41 AM
  • Set all the projects (solution) to "Release" vs "Debug" build.

    This worked fine for me.
    In the solution configuration properties, the setup was selected for build but not the assembly containing the installer class.

    thanks
    Thursday, October 8, 2009 8:10 PM
  • I guess you are Building in Debug-mode. Change to Release-mode.
    Tuesday, August 16, 2016 1:06 PM