Bob
Bob

Reputation: 1375

The type 'StringPro.IMyString' is defined in an assembly that is not referenced

I receive this error when trying to run the client.

The type 'StringPro.IMyString' is defined in an assembly that is not referenced.

This error comes from, StringProClient from file Program.cs and underlines in blue the following first line of code:

StringProProxy.StringProProxy proxy = new StringProProxy.StringProProxy();

The solution has 4 projects inside:

StringPro - Class Library that contains the service's interface(IMyString.cs) and the implementation class(MyString.cs)

StringProHost - Console Application that has Program.cs inside which defines Uri, ServiceHost, Endpoint, ServiceMetadataBehaviour, HttpGetEnabled, host.Description.Behaviours, calls host.Open() and displays in console information about when the service was started

StringProProxy - I believe it's a Class Library project since it has only StringProProxy.cs which defines the service's proxy

StringProClient - Console Application which instantiates the service's proxy inside, call the service's functions and displays results.

EDIT: The service host launches fine. It's the client that won't build and run because of the mentioned error.

Upvotes: 0

Views: 141

Answers (2)

Pratik
Pratik

Reputation: 161

Such problem mostly arises with the issues like namespace only. Kindly check your references as well as namespaces again.

Upvotes: 0

Marcin Deptuła
Marcin Deptuła

Reputation: 11977

If a project is using a type that was declared in other assembly, this assembly must be referenced - this is basically what your error is telling you.

In your case, I'm guessing that StringProClient is referecing StringProProxy, but it is also using types declared in StringPro project (to be exact: IMyString interface/class), without referencing it. You should make sure, that StringProClient references both, StringProProxy and StringPro.

Upvotes: 2

Related Questions