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.
I'm not sure what's wrong but here's some links I found useful:
A good Article
Creating a Windows Service
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.
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.
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.
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
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
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.
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
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.