CreateManifestResourceNames load failure in 16.3 for third-party languages that use it
This issue has appeared since updating to 16.3 and appears related to #4597
Our third-party language build task has derived from CreateManifestResourceNames for years (probably since the original MSBuild). A change has added a new internal property:
https://github.com/BenVillalobos/msbuild/blob/ded7c259dcd3e1c25e342af42916bbe4e3a3a0cf/src/Tasks/CreateCSharpManifestResourceName.cs#L20
Users updating to 16.3 will get a load fail on our build tasks, or compiling from source will give a compilation error. The workaround I have (and which F# already does and is referred to in the PR) is to derive from the C# task instead (CreateCSharpManifestResourceNames).
That doesn't feel entirely correct as the default value of the property will be '.cs' and I suppose at some point in the future it may be desirable to want to override this (and I assume also for F#).
The various resolutions to this I can see:
- Carry on with the workaround of deriving from CreateCSharpManifestResourceNames. Right now, the additional functionality added is not relevant.
- Write our own version of CreateManifestResourceNames. Even though MSBuild is now open source, my initial investigation of this shows up more issues with internal type use, making this not so straightforward as I'd hoped.
- Modify the SourceFileExtension property to be 'protected'.
This last resolution would be my preferred solution but I see from the code review comments that this property was changed from 'public' to 'internal'. Any chance of changing it to 'protected'?
Are there any other suggestions or comments?
cc @rainersigwald @BenVillalobos
@sae42 There is no reason we can't change the modifier to protected. Will get a PR going soon.
I suspect that if it was originally made internal the best solution is for it to be public, not protected; but whatever works. Will the fix make it to 16.4?
@BenVillalobos Thanks! @renerod I suggested protected just to be consistent with the other abstract members in the base class (IsSourceFile and CreateManifestName).
@sae42 I agree, it's just that internal suggested (to me) that SourceFileExtension was being referred to from some other class in the assembly, and making it protected might cause a regression bug. That's why public makes more sense to me. Either public or protected works for me (and I suspect for you too), so whichever of the two @BenVillalobos decides is fine.
@renerod this will definitely make it into 16.4. Preview 3 at the soonest. As per https://github.com/microsoft/msbuild/pull/4821#issuecomment-542820765, we'll keep it as protected unless there's a very realistic case for a regression that's flying over our heads at the moment.
Awesome, thanks!