Updating Service References

Topics: General Discussion Forum
Mar 13, 2007 at 9:08 PM
Hi everybody,

I'm wondering how we can update a service reference once we expose more services.
We are having some problems with this. Let me describe you our solution and environment:

We are using the WSSF along with a CAB SmartClient. We have several modules and all of them must access the services exposed by our backend. So, in each module we have several service references. Our team is composed by 10 people using VSS.

So far, if one team member adds a new service, he has to regenerate the service reference. The problem here is that although the newly created service reference is checked-in source control, when other team member does a "Get Latest Version" that reference doesn't work: it has to be regenerated in the other PC. So it would be nice if we could UPDATE those services references in order to simplify our development.

Another problem is that as the references are added to a CAB module, the wizard adds entries into the module's app.config although the correct one to place those entries should be the Shell's app.config. We are copying the entries from one app.config to the other... being very annoying.

Any solutions or suggestions regarding these issues would be highly appreciated :)

Thanks in advance!!
Mar 14, 2007 at 3:42 AM
Regarding your first issue, I think I don't get it why you need to regenerate the service reference (it's a simple folder with a class inside). You should be fine getting it from source control. This should work the same as the built-in Web Reference option in VS where you can sync up with source control.

The problem with you app.config location is a bit more difficult to solve since the current behavior is by design (you selected project is considered as the client app with its own app.config file. However, you can modify the WCF Guidance Package (from the source code provided in WSSF) and specify your Shell project as the location for your config file.
If you want to do this, then just follow these steps:
  1. Locate the ConnectToWCFService.xml recipe in "Recipes\WCF" folder.
  2. Locate the argument named "Configuration" and change the "SelectedProject" attribute in the ValueProvider to "ShellProject".
  3. Add a new argument element below the Configuration argument like this:
<Argument Name="ShellProject" Type="EnvDTE.Project, EnvDTE, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Required="true">
  <Converter Type="ProjectConverter" />
  <ValueProvider Type="ProjectByNameProvider" Path="MyShellProjectName" />
Notice that the Path attribute points to your Shell project name (MyShellProjectName).
Of course that this solution is quite "custom" since you are hard coding your shell project name, but is very straightforward as well. A more general purpose solution would require some major changes in the wizard page to allow the user select the shell project from all the projects marked with the "Client" responsibility. This approach is not rocket science but it far more involved than this approach.

Mar 14, 2007 at 12:29 PM
Great Charly, thanks again.

The approach you provide to solve the app.config issue it's really fine to me.

About the other issue, the service reference one, I'll continue digging and if I need some more advice I'll post right here.