Skip to content

Only add global usings when ImplicitUsings is enabled#13322

Closed
ronaldbarendse wants to merge 9 commits intov11/devfrom
v10/bugfix/implicit-usings
Closed

Only add global usings when ImplicitUsings is enabled#13322
ronaldbarendse wants to merge 9 commits intov11/devfrom
v10/bugfix/implicit-usings

Conversation

@ronaldbarendse
Copy link
Copy Markdown
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

Description

As suggested by @JimBobSquarePants, the global usings in the Umbraco.Cms package should only be added when ImplicitUsings are enabled in the consuming project.

Because users could have disabled ImplicitUsings on their v10 project, but still depend on the global usings Umbraco adds (and therefore not have added explicit usings), this might be a source code breaking change. I've still targeted this PR to v10, so we can include it in the next minor version or otherwise easily cherry-pick into v11.

Testing can be done by first disabling implicit usings in the Umbraco.Web.UI (before applying this PR) by adding <ImplicitUsings>false</ImplicitUsings> to the project file and adding explicit usings for the System.* and Microsoft.* namespaces (see docs).

Next apply this PR and notice you now also have to add explicit usings for Umbraco.Cms.Core.DependencyInjection and Umbraco.Extensions 👍🏻

@ronaldbarendse ronaldbarendse changed the base branch from v10/dev to release/11.0 November 28, 2022 15:56
@ronaldbarendse ronaldbarendse changed the base branch from release/11.0 to v11/dev November 28, 2022 15:58
@ronaldbarendse
Copy link
Copy Markdown
Contributor Author

Since this change potentially results in a code breaking change, I've targeted v11 and created a new PR: #13491.

@ronaldbarendse ronaldbarendse deleted the v10/bugfix/implicit-usings branch November 28, 2022 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants