Base solution for your next web application
Open Closed

Code generated by PowerTools - Feature 'file-scoped namespace' is not available #12264


User avatar
0
MainTechAS created

Hi,

In version 4.5.0 of PowerTools alle templates are updatet implementing the feature 'file-scoped namespace' in all C# files created, this is all good and well, but not for template code generated for projects still not upgraded from target framework netstandard2.0

Error (active) CS8370 Feature 'file-scoped namespace' is not available in C# 7.3. Please use language version 10.0 or greater.

Such as projects

  • .Core.Shared
  • .Application.Shared

I hesitated to upgrade the projects, so as a workaround, I created "a lot" of MainTemplate.custom.txt files avoiding the issue. Yep I know, only a temporary workaround.


2 Answer(s)
  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @MainTechAS,

    Add the tag below to your common.props file, otherwise, you will get an error when building the solution after code generation.

    <LangVersion>latest</LangVersion>

  • User Avatar
    0
    MainTechAS created

    Ah, sweet, thanks