Base solution for your next web application
Open Closed

Update to ASP.NET Zero V14.1 - how to merge C# files with mixed file-scoped and block scoped namespaces #12452


User avatar
0
hongbing.wang created

ASP.NET Zero V14.1 has many C# files with file-scoped namespaces while the rest are still with block scoped namespaces. Pure file-scoped files: 985 Block-scoped only files: 189

Our Zero app is running V13.2. We want to upgrade it to V14.1. After merging with V14.1, we found that the change to use file-scoped namespaces caused lots of unresolve conflicts. Just the webapi component has more than 100 files with conflicted changes. Many app service classes have over 50 up to 70 unresolved conflicts. It appears that svn tool couldn't handle it properly. It's too hard to do manual merge this time.

Please advise how to update to V14.1 in this situation.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

5 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @hongbing.wang

    To resolve the file-scoped namespace conflicts, you can migrate your v13.2 project to the file-scoped namespace structure. Instead of doing it manually, you can easily configure this in your IDE's settings (e.g., Rider or Visual Studio 2022) by selecting file-scoped namespace as your preferred code style and then applying it to the entire project using code cleanup or Refactor > Adjust namespaces features. After completing this, the merging process will be easier, and resolving conflicts will be more straightforward.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    hongbing.wang created

    Hi @oguzhanagir,

    Thank you for your prompt reply.

    Your advice is helpful.

    Why are the 189 block-scoped only files not changed to file-scoped? Any particular reason? Please see the screenshots with block scoped files attached. Please advise how to handle them.

    Do you expect these files to be changed to file-scoped in next Zero release?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @hongbing.wang

    Thank you for your feedback. Yes, you are right some files are still using block-scoped namespaces. I have created an issue for this, and you can follow the progress there. To resolve this, when you run the Code Cleanup command in your IDE on a branch created from the latest version of ASP.NET Zero, it converts 128 files to use the file-scoped namespace structure. Some files you specified do not exist in the namespace.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    hongbing.wang created

    Hi @oguzhanagir,

    Please give us an update for this issue. It seems the link https://github.com/aspnetzero/aspnet-zero-core/issues/5701 is broken.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @hongbing.wang

    To access this link you specified, after logging in with the user who has the plan on the aspnetzero.com website, clicking the manage button under the Account button, you can give permission to the github user you are trying to log in from the Github Members tab on the relevant page.

    The issue you specified was published with v14.2. By updating to AspNet Zero v14.2, the issue you specified will be resolved.

    Thank You

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)