Comments (9)
from templates.
Funnily enough I filed this ~13 years ago before I joined Microsoft, and it was "fixed" by restricting the user from putting an empty Default Namespace via the UI. ie This bug has always existed since Whidbey.
I'm not sure what the real fix is here - put a fake namespace? Don't generate a namespace for the class itself (which would require us to basically ship different templates just for the empty case)?
from templates.
We could write a wizard that removes the namespace text if the rootnamespace
property is empty. UI-less template wizards can make arbitrary file modifications and read the dictionary of all template parameters. What does dotnet new
do if you set the default namespace to nothing?
from templates.
You could probably hack it with the basic #if support, but then you'd also need to format the document afterword.
from templates.
In VS I it will auto-format the file on creation. Don't know if any of that works in the CLI templating engine
from templates.
Why not just fall back to the name of the project? That doesn't seem fake to me, considering the "default default" namespace is the project name.
from templates.
@SolderedMushroom Because the this isn't the case where the default namespace is set to the project name, this is the case where the default namespace is literally empty.
from templates.
@davkean Right, my point is just that since an empty namespace is invalid, falling back makes sense, and the project name is the "true" default (what you'd get if the default namespace isn't user-specified).
from templates.
The template should prevent this from happening
from templates.
Related Issues (20)
- defaultName option not working as expected with Item templates HOT 1
- Add i18n examples to templates
- Proposal: Two console templates: console & main HOT 2
- Inconsistent capitalisation of "Class library" template
- dotnet new command should work with the Name provided without the need to specify the name option (-n)
- Preprocessor directives within comments are also getting processed while invoking the dotnet new command
- Angular SPA template fails to start
- Angular SPA Template with Individual Auth doesn't work when the project name contains spaces HOT 2
- Add solution name to project name ? HOT 1
- Is it possible to create a user input parameter where multiple values can be entered seperated by a ";" ?
- EditorConfig Template description should be updated from `default` to `empty` HOT 1
- Introduce `dotnet new` templates for analyzers/codefixes, refactorings, and source generators
- [net8 preview 2] dotnet new command never finishes for unknown parameter condition evaluation HOT 4
- ASP.NET Core template should configure Data Protection API key storage
- Add a template for RESX files HOT 3
- SolutionName bind variable
- Update the class template to add the sealed modifier by default HOT 3
- Git option in templates
- All dotnet core templates should have docker-file support
- Let template access MSBuild properties.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from templates.