1

I am designing a windows service and now deploying it.

I have the code:

ServiceInstaller serviceInstaller1 = new ServiceInstaller();

This instantiates the object (obviously, but throws the following compile-time error:

Error 1 The type 'System.Configuration.Install.ComponentInstaller' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. C:\Users\firstname.lastnameDocuments\Visual Studio 20

How do I fix this? I'm thinking I need an app config file in my Windows Service?

4

2 回答 2

5

构建时是否在您的开发机器上出现此错误(看起来像这样)?或者安装时在目标机器上?

如果是前者:照它说的做:添​​加所需的参考;参考->添加参考->System.Configuration.Install

它应该已经安装在目标机器的 GAC 中,所以不应该做任何其他事情。

于 2008-11-05T12:04:13.757 回答
0

System.Configuration.Install should be in the GAC. Is it not there? Does the target machine only have .NET 1.0 or 1.1? Or does the app.config (which you say you might not have present) stipulate one of those earlier .NET Framework versions should be used?

Ah, it is on the dev machine. Then you should go with Marc's answer and just add a reference to the System.Configuration.Install assembly to your project.

于 2008-11-05T12:00:32.577 回答