Skip to content

Conversation

@RussKie
Copy link
Contributor

@RussKie RussKie commented Jul 1, 2021

Resolves #5074
Relates to dotnet/sdk#18459

Global usings can be disabled in the following way:

  • DisableImplicitNamespaceImports disables *ALL* global usings
  • DisableImplicitNamespaceImports_WindowsForms disables Windows Forms specific global usings

It is possible to add additional usings via:

  <ItemGroup>
    <Import Add="MyCompany.Super.CoolStuff" />
  </ItemGroup>

It is possible to remove selected usings

  <ItemGroup>
    <Import Remove="System.Drawing" />
  </ItemGroup>

Screenshots

Referenced through the Microsoft.NET.Sdk.WindowsDesktop.props this leads to the following:
image

Test methodology

  • Manually locally modifying the installed SDK
  • Building winforms -> wpf -> windowsdesktop
Microsoft Reviewers: Open in CodeFlow

@RussKie RussKie requested a review from a team as a code owner July 1, 2021 11:01
@ghost ghost assigned RussKie Jul 1, 2021
@RussKie RussKie added waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) ⛔ blocked Blocked by external dependencies labels Jul 1, 2021
@RussKie RussKie force-pushed the 5074_globalusings branch from 651bf8a to f389ed3 Compare July 9, 2021 05:16
@RussKie RussKie removed waiting-for-testing The PR is awaiting manual testing by the primary team; no action is yet required from the author(s) ⛔ blocked Blocked by external dependencies labels Jul 9, 2021
RussKie added a commit to dotnet/wpf that referenced this pull request Jul 9, 2021
@RussKie RussKie merged commit 6345cb2 into main Jul 9, 2021
@RussKie RussKie deleted the 5074_globalusings branch July 9, 2021 06:42
@ghost ghost added this to the 6.0 Preview7 milestone Jul 9, 2021
RussKie added a commit to dotnet/wpf that referenced this pull request Jul 15, 2021
RussKie added a commit to dotnet/wpf that referenced this pull request Jul 19, 2021
@RussKie RussKie modified the milestones: 6.0 Preview7, 6.0 rc1 Jul 23, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update C# templates with global usings

2 participants