0

I have c# solution in Visual Studio. projects are:

  • MyLib - pure dll
  • MyWebService - wsdl
  • MyClient - project that has web service of MyWebservice

I want to attach/publish MyLib together with MyWebService to be visible all definitions of structures, enums etc from MyLib to MyClient.

For example I do in my client something like this:

using MyWebService.MyLib;
CodeCaster
  • 147,647
  • 23
  • 218
  • 272
Dragon
  • 303
  • 3
  • 5

1 Answers1

2

Just add a reference to MyLib in your MyClient project.

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • And quite possibly set the Copy Local property of the referenced dll to true. – Paul Zahra Jan 08 '15 at 11:06
  • That is what I want to avoid. To have dependence only MyClint on MyWebService not on MyLib. – Dragon Jan 08 '15 at 11:20
  • You can download the assembly in the client at runtime, but then you can't use it in your code directly and you'll lack static typing and IntelliSense in your client project (as it won't know the types). You'll then have to use reflection to load and instantiate the types.You _can_ do that, but you don't want to, certainly not if you have to ask how. Please try to explain your original problem properly, as your currently proposed solution to it won't be very useful. – CodeCaster Jan 08 '15 at 11:22
  • @Dragon Have a read of http://stackoverflow.com/questions/10210729/why-do-i-sometimes-have-to-reference-assemblies-referenced-by-the-assembly-i-r – Paul Zahra Jan 08 '15 at 11:29
  • Root problem is to make one project dependency. Beside 3 project that I mention I have lot other projects that are using MyClient. So I want to solution that they depeand only on MyClient. So I do developing in MyLib and MyWebService, make update service reference in MyClient project and all types are visible again. – Dragon Jan 08 '15 at 11:31
  • Then you need to create a service reference, so the classes will be generated again in the client library. – CodeCaster Jan 08 '15 at 11:32
  • I update previous comment. I have service reference of MyWebService in MyClient and I see only types that are on interface, however I want to see all types definitions from MyLib to MyClient passed over web reference in MyWebService – Dragon Jan 08 '15 at 11:36
  • @Dragon you can't. Types that aren't used in the service aren't in the WSDL and XSDs, so your client can't generate them. You need to add a reference if you want to use those types. – CodeCaster Jan 08 '15 at 11:37
  • @Dragon Have you considered compiling the wsdl to a dll? See http://www.lightsoftai.com/?p=1054 – Paul Zahra Jan 08 '15 at 12:04
  • @Paul that won't include types in the DLL that aren't exposed through the service. – CodeCaster Jan 08 '15 at 12:06
  • @CodeCaster But if he effectively converts it to a class then he could instantiate the interface etc using the dynamic keyword thereby giving access further down the line? – Paul Zahra Jan 08 '15 at 12:08
  • @Paul OP said in a comment _" I see only types that are on [the service] interface, however I want to see all types definitions from MyLib"_. So any type defined in the MyLib that isn't exposed through the service, won't be in the class. – CodeCaster Jan 08 '15 at 12:10