Reputation: 763
In one Visual Studio solution, I have several projects. A couple of them access a certain web service. How can I add a service reference once, and have it used by both projects? I do not want to create an extra assembly for the sole purpose of providing access to the web service.
Upvotes: 2
Views: 202
Reputation: 88092
The service reference setup is actually stored in the project file; so, this isn't really viable and it's not any different from both projects referencing a common assembly.
The only "option" I can think of is if project B has a reference to Project A and Project A has the web reference to your web service, then B can call A which calls the Web Service.... But that only serves to hide your dependency.
This doesn't exactly sound like a problem worth solving. Especially if the two projects can be deployed independently.
Upvotes: 0
Reputation: 11319
You have to add the reference to the service in each project that references the project. When the reference is set a service proxy class is auto-generated that represents the web service in the project that references it.
Upvotes: 1
Reputation: 14448
Without creating a special project just for the web service, i don't think that is possible. You would need to add a service reference for each project that needs direct access to the service.
Upvotes: 2