-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix module template Startup namespaces (Lombiq Technologies: OCORE-111) #12896
Conversation
Do we have |
We have but that only generates this: global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks; |
It worked for me when I tested them. Of course it can maybe fail to compile based on your solution settings. |
I don’t think we need this, if the project is web Microsoft.AspNetCore.* will be added When I tested web/module template it was working, can you confirm if you have Web sdk in csproj? |
Yes implicit using is enabled by default in project templates |
This is with a web project in the root if this is what you mean (as well as the module, but that comes from the template). But see for yourself, the resulting solution won't build:
|
@Piedone Sorry my bad - What I meant by With implicit using enabled,
|
The modules are not web projects per se, though. But semantics aside, the Razor SDK needs to be used in modules and themes, otherwise, Razor templates won't work when you publish the app. So, I still see importing the namespaces as the solution. The MVC module needs the same fix indeed, so I've added that. |
Orchard Modules are not Web, However it's also not same as RazorLibs. It's kind somewhere in between as It may have So IMHO with If you prefer to keep |
Related #12676 |
Using the targets props for implicit usings is an interesting idea. I've added an example of this (not complete, only for modules), please check. However, I don't really like it. To begin, What does everyone think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to introduce another #if block while it's already there in line 4
@@ -1,4 +1,6 @@ | |||
#if (AddPart) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if (AddPart) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, with the new central imports indeed not, though I'm awaiting feedback on that.
using Fluid; | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#endif |
Since apparently nobody has a strong opinion on the props imports I mentioned in my last comment, I'm merging this in the state Antoine approved. |
Without these namespaces, a freshly created solution will have these build errors: