cake: Warn and skip code gen for duplicate aliases

PR #2455 created a conflict with existing Cake.Incubator addin

- (2688,10): error CS0111: Type 'Submission#0' already defines a member called 'EnvironmentVariable' with the same parameter types

Repro script

#addin nuget:?package=Cake.Incubator&version=3.1.0

What we think we need to do here is track methods generated by code gen and skip & warn on any duplicates, prioritizing what’s in Cake.Common.

Likely would need to add using statements to avoid errors with aliases being invoked on ICakeContext

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

@wwwlicious with 4.0 impact looks better

- Namespace Cake.Incubator.EnvironmentExtensions excluded by code generation, affected methods:
-         Method "EnvironmentVariable" excluded from code generation and will need to be fully qualified on ICakeContext.

@gitfool I’ll say leave as is.

No new Cake version should be required.

If there’s no aliases in a namespace it won’t to be imported automatically and would need a using statement tool be found.

You can automatically import namespaces via attributes on an alias

https://github.com/cake-build/cake/blob/5e8e454abd071d1553f0cae7e01e616bf7f7be57/src/Cake.Common/Tools/DotNetCore/DotNetCoreAliases.cs#L51