-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.Web.Services.Description package needed for improving WSDL support #4637
Conversation
@ericstj, basically I'm trying to create a reference assembly using Roslyn so as not to need to maintain source files, and then generate the type forwarding facade for NetFx. I tried doing this in the src project, but generation of the NetFx façade and the reference assembly are tied together in the ref project. So instead I'm referencing the same product code from the ref project but telling Roslyn to only generate the reference assembly. I'm running into problems where generation of the SR.xxxxx source files is being disabled in the ref project (I can't work out where so can't work out how to override). Then Roslyn instead of failing the build generates a reference assembly skipping any methods which reference resource strings, so you get a weird broken assembly (the generated assembly looks like it's missing some necessary boilerplate stuff and is really broken). |
It's up to you of course, but in dotnet/runtime we see the maintenance of public API sources as a bit of a feature. It's a way for us to keep track of the public API separately and scrutinize API changes and ensure they go through review. We've considered eliminating the ref projects, but keeping the source (as an input to API Compat). Why do you need a reference assembly here? In the cases of the other WCF assemblies they need to have a reference assembly since the types are in a different place at compile time (System.ServiceModel.*) than runtime (System.Private.ServiceModel) since that's not the case here, then I'd suggest you avoid it as it is unnecessary complexity and grows the package. You can still use the roslyn feature to generate a reference assembly in order to get the incremental build benefits if you like.
All you need to generate a facade is a assembly to use as input to specify the types. The targets here assume that input is a reference assembly project. wcf/eng/FacadeAssemblies.targets Line 19 in 2fcb054
Those can use a different input, as I did here: ericstj@adfab46#diff-207f6e98d9caeaca81338ee172b4875cce4ac6a5f1ed4d5ce0d1eaca338dbf8fR16 Perhaps we can work on changing those targets to accomodate your scenario as well? Make the new target apply when running on either a reference assembly or a src assembly that has no reference assembly. |
The reason for a reference assembly is these types exist on NetFx so we have the netstandard2.0 lib assembly for .NET Core/.NET and we need a type forwarding facade for net461 to forward to System.Web.Services.dll in the framework. |
Please see above. I don’t think you need a reference assembly project in this case since your source assemblies have the same type location as references. If you want you can still produce reference assemblies from the compiler but you don’t need a separate project. |
Are you saying I get rid of the .Ref.csproj and it can all be generated from the single project? I have too much missing context in how those changes you linked to work to be able to work out what changes I need to make this all fit together. What I gather so far is this:
Beyond that I'm lost as to what changes I need to make. |
Let me make the suggested changes now that the other PR is merged. |
So it turns out that after merging my latest changes all I needed to to was delete the reference assembly project: ericstj@9077676 A reference assembly is not needed at all, you just use the implementation assembly for reference and the same can be done for the .NETFramework façade. Note that this is the normal/best-practice way to ship packages. Reference assemblies (even when produced by the roslyn wcf/eng/FacadeAssemblies.targets Lines 55 to 63 in 6fb541b
|
After removing the Ref project, I also had to set EnableDefaultEmbeddedResourceItems to false for net461 as it was adding the strings as a resource. Now the project has:
Will the type forwarding façade work as a reference assembly if a consuming library multi-targets to net48 for example? |
A library targeting |
I gave it a test and looked at what's in the package and it matches what our existing packages do. The bit I don't understand is why we don't limit the set of api's visible on netfx to the api's available to netstandard2.0? When referencing System.Web.Services.Description on net48, I am able to reference in my code any types that exist in System.Web.Services in the GAC. This is also true of System.ServiceModel.Primitives which allows me to reference any types in System.ServiceModel or System.IdentityModel. I had expected a reference assembly for S.SM.Primitives for net461 to limit the set of types but it doesn't. |
Facades aren't meant to limit the types exposed. They unify the types from one assembly with those that exist in another assembly. In this case you're defining a new assembly |
@HongGit, can I merge this? |
No description provided.