Windows Service Setup Project Problems Converting

2019-07-16 14:03发布

问题:

I'm trying to convert a solution from VS.NET 2008 to 2010. The solution includes a Windows Service project and a Setup project that installs the Windows Service. I'm having trouble compiling the Setup project. I've tried starting this over from scratch a few times, following the tutorial here under the section titled To create a setup project for your service.

When I simply follow these steps and build the project, I get this error:

Unable to build custom action named 'Primary output from <name> (Release x86)', InstallerClass property is only valid for assemblies.

(where is the name of my Windows Service project). A search for this error brings up this page on MSDN which tells me to set InstallerClass to False. I do so for each of the 4 Custom Actions. After making this change and building, I get the following error:

Unable to build custom action named 'Primary output from <name> (Release x86)' from project output group 'Primary output' because the project output group does not have a key file.

Googling for that, I only get a single hit. Don't even bother clicking the link, the full text is: "Remove the custom action and replace it with a custom action pointing to a project output group that has a key file."

What the h does that mean? Can anyone help me figure out what I'm doing wrong here?

回答1:

It looks like the problem was when I set InstallerClass to False. Apparently, I hadn't built the Windows Service for the x86 target. I got the hint from this discussion. I changed all of the projects to target the correct platform and left InstallerClass set to True for each of the Custom Actions in the setup file and it's building now.



回答2:

This is kinda old but just ran into this error myself: Migrated vs2008 to vs2010, setup project did not give error in one specific config but did in 2 other configs that included the setup project. Found that when originally created, someone had Added primary output from a specific configuration (Not "(Active)"). So when a different config was built, setup would throw this error. (probably had this problem prior to migration to vs2010.)
To fix:

  1. Copy custom actions names and CustomActionData strings (just text to recreate easily)
  2. Delete custom actions
  3. Delete primary output & content files (this was web setup project)
  4. Add back in primary & content, selecting (Active) config
  5. Add back custom actions

Now it all builds without error.



回答3:

Rebuild the project which class installer class individually, and then rebuild the installer project.