Git Product home page Git Product logo

Comments (9)

tannergooding avatar tannergooding commented on August 31, 2024

FYI. @srivatsn, @jaredpar

from templates.

davkean avatar davkean commented on August 31, 2024

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.

jmarolf avatar jmarolf commented on August 31, 2024

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.

davkean avatar davkean commented on August 31, 2024

You could probably hack it with the basic #if support, but then you'd also need to format the document afterword.

from templates.

jmarolf avatar jmarolf commented on August 31, 2024

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.

SolderedMushroom avatar SolderedMushroom commented on August 31, 2024

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.

davkean avatar davkean commented on August 31, 2024

@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.

SolderedMushroom avatar SolderedMushroom commented on August 31, 2024

@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.

jjmew avatar jjmew commented on August 31, 2024

The template should prevent this from happening

from templates.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.