Question

I've added a Service Reference to a portable class library and I am able to use it without hitches but for the life of me I cannot figure out why the Access level for generated classes is restricted to Public only. This makes no sense to me, the whole reason one would want to include a Service Reference in a portable class library is to wrap its functionality into friendlier classes that compose the WCF service calls into higher level methods at the same time being able to share the wrapper between multiple platforms.

I thought that it may be because of the Platforms I had included in the library but after having removed must and leaving only Windows 8 and .NET 4.5, I still cannot change the Access level.

Is there any explanation for this?

Thanks

Was it helpful?

Solution 2

I managed to fix the issue by manually editing ($ProjectDir)/Service References/Reference.svcmap file. It was simple really and should have thought of it sooner. I may end up breaking something down the line (there has to be a reason for disabling the Access level for generated classes) but as long as it works for now it'll do.

Inside the file there is a tag which must be set to true:

<GenerateInternalTypes>true</GenerateInternalTypes>

I would still like to know if anyone has any information on why the Access level for generated classes is forced public when adding a Service Reference to a portable class library. So if anyone out there could shed some light, please do :)

OTHER TIPS

When you add the service reference, click the 'Advanced' button. The first item in the resulting Service Reference Settings dialog gives you the ability to generate either Public or Internal members for your service proxy classes.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top