views:

671

answers:

4

Hi,

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?

A: 

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.

flipdoubt
A: 

I'll check the GAC. Not sure how (rarely used GAC), but I will check.

There is no app.config file in the solution.

dotnetdev
Look in %systemroot%\assmbly, usually C:\assembly. The .NET Framework installer should have added the System.Configuration.Install assembly to the GAC for you, so you should see it listed there.
flipdoubt
@GSS - it would be clearer to read if you used comments for updates/replies like these...
Marc Gravell
+2  A: 

Is this error on your dev machine when building (which is what it looks like)? Or on the target machine when installing?

If the former: do what it says: add the required reference; References->Add Reference->System.Configuration.Install

It should already be installed in the GAC of the target machine, so there shouldn't be anything else to do.

Marc Gravell
A: 

Marc,

It's on the dev machine. I forgot to add a reference via References (like I do when adding System.Web or a custom Dll, like from a 3rd party provider).

That works now.

Thanks guys

dotnetdev