3

I have a strange problem that's proving difficult to diagnose. After adding an Assembly reference that contains the namespace Matrix.System to a Windows Service project, I'm now getting this error when compiling the service:

The type or namespace name 'ComponentModel' does not exist in the namespace 'Matrix.System' The type or namespace name 'ServiceProcess' does not exist in the namespace 'Matrix.System'

The errors are generated in the service though:

private System.ComponentModel.IContainer components = null;
private System.ServiceProcess.ServiceInstaller serviceInstaller1;

and in the service setup project I'm getting this:

Unable to find dependency 'IONIC.ZLIB' (Signature='EDBE51AD942A3F5C' Version='1.9.1.5') of assembly 'Apache.NMS.ActiveMQ.dll'

the NMS assembly is already in the setup project and everything was working fine until I added the Matrix.System assembly

Zbigniew
  • 27,184
  • 6
  • 59
  • 66
codebrane
  • 4,290
  • 2
  • 18
  • 27

2 Answers2

5

You can "root" the namespace like this:

using global::System.ComponentModel;

(Then get rid of the fully-qualified references in your code.)

Or if you really want to use fully-qualified namespaces:

private global::System.ComponentModel.IContainer components = null;
private global::System.ServiceProcess.ServiceInstaller serviceInstaller;

This looks unrelated to the other dependency issue though.

My guess is that in the same class you've got:

using Matrix;

otherwise I wouldn't expect it to be a problem in the first place.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • thanks for that. Reading your answer made me realise that Matrix.System was in some way 'masking' the System namespace. Changing Matrix.System to something else and reimporting solved the problem. Many thanks – codebrane Jul 07 '12 at 08:47
2

You need to install system.componentmodel from Nuget admin packages. Cause there's no system.componentmodel in either Microsoft references or system. Be aware that it is not supported on framework 2.0, requires at least .Net framework 4.3

enter image description here

enter image description here

Grigory Zhadko
  • 1,484
  • 1
  • 19
  • 33
Devmyselz
  • 346
  • 3
  • 13