Skip to content
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

Support ImplicitUsings in project and item templates #373

Merged
merged 6 commits into from Jun 5, 2023

Conversation

DavidBoike
Copy link
Member

@DavidBoike DavidBoike commented Jun 2, 2023

Endpoints will use <ImplicitUsings>enable</ImplicitUsings> on target frameworks where the setting is supported. NServiceBus supports implicitly using the NServiceBus namespace. Code files generated as part of the endpoint will not emit default implicit using namespaces when this is active.

Item templates for handlers and sagas will also bind to the MSBuild value to determine whether to generate using statements. This only works if a dotnet restore has been done on the project, which Visual Studio does automatically, and which will be done as a postAction on the endpoint template, but there's not a lot that can be done about that for externally-built projects used outside Visual Studio.

@DavidBoike DavidBoike added this to the 5.0.0 milestone Jun 2, 2023
@DavidBoike DavidBoike self-assigned this Jun 2, 2023
@bording
Copy link
Member

bording commented Jun 2, 2023

Given that I think we should also be including <Nullable>enable</Nullable>, I'm wondering if we should instead have a IsNetFramework property that could be used to handle Nullable and ImplicitUsings.

@DavidBoike
Copy link
Member Author

@bording changed it for the endpoint template, where we are in control of the framework and how that turns into ImplicitUsings. But for the item templates it won't be that simple given you could be adding a handler to a net7.0 project where you've disabled ImplicitUsings.

@DavidBoike DavidBoike merged commit 8034c95 into master Jun 5, 2023
2 checks passed
@DavidBoike DavidBoike deleted the implicit-usings branch June 5, 2023 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants