Base solution for your next web application
Open Closed

Upgrading from 13.2 to 14.1 #12472


User avatar
0
philipcj created

I am looking at upgrading a project from 13.2 to the latest version 14.1. Reading https://docs.aspnetzero.com/aspnet-core-mvc/latest/Version-Updating it isn't totally clear I just wanted to check: This document doesn't say what to do with aspnetzero branch - it looks incomplete

Please can you confirm this for me?

Is it also possible to keep my existing git history?

I would have expected that I merge in changes from the latest version (14.1) but the document doesn't say how to do this.

Please can you explain and / or update this document???

Many thanks

P.S. I am using ASP.NET Core with jQuery

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

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

    Hi @philipcj

    The aspnetzero branch should contain a clean version of the base AspNet Zero framework code no customizations. You’ll use it to pull updates in future upgrades. It's created from a clean scaffold of the version your project originally started with.

    Create a Clean Base of Your Starting Version

    • Go to aspnetzero.com and download a clean project using the version your project originally started with (e.g., v13.2).
    • Use the same project name and settings (ASP.NET Core + jQuery).
    • Add this clean project to a new repository, commit it to master.

    Branch Setup

    git checkout -b dev
    git checkout -b aspnetzero
    git checkout -b migrate
    

    Copy Your Existing Project to migrate Branch

    • Overwrite the scaffolded files in migrate with your real project code (from your current project).
    • Commit changes.

    Merge migrate into dev

    git checkout dev
    git merge migrate
    
    • This is where you’ll get conflicts. You’ll need to resolve them manually.
    • You're basically merging your real project into the fresh scaffolded layout, while keeping structure in line with the latest upgrade model.

    Upgrade aspnetzero to the Latest (v14.1)

    • Download a clean project again this time using version 14.1.
    • Overwrite contents of your aspnetzero branch with this v14.1 scaffold.
    • Commit changes.
    • Tag the commit with something like aspnetzero-v14.1.

    Merge aspnetzero into dev

    git checkout dev
    git merge aspnetzero
    
    • Again, you’ll face conflicts. This is where your real work begins resolve all conflicts carefully.
    • Make sure to review breaking changes and update your project accordingly.

    This approach preserves full Git history. After merging, your dev branch becomes your main development branch, now upgraded to 14.1. You’ll be able to repeat this upgrade process in the future using the same branch strategy. You can delete the migrate branch after merging it to dev.

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

    Hi @philipcj

    The aspnetzero branch should contain a clean version of the base AspNet Zero framework code no customizations. You’ll use it to pull updates in future upgrades. It's created from a clean scaffold of the version your project originally started with.

    Create a Clean Base of Your Starting Version

    • Go to aspnetzero.com and download a clean project using the version your project originally started with (e.g., v13.2).
    • Use the same project name and settings (ASP.NET Core + jQuery).
    • Add this clean project to a new repository, commit it to master.

    Branch Setup

    git checkout -b dev 
    git checkout -b aspnetzero 
    git checkout -b migrate 
    

    Copy Your Existing Project to migrate Branch

    • Overwrite the scaffolded files in migrate with your real project code (from your current project).
    • Commit changes.

    Merge migrate into dev

    git checkout dev 
    git merge migrate 
    
    • This is where you’ll get conflicts. You’ll need to resolve them manually.
    • You're basically merging your real project into the fresh scaffolded layout, while keeping structure in line with the latest upgrade model.

    Upgrade aspnetzero to the Latest (v14.1)

    • Download a clean project again this time using version 14.1.
    • Overwrite contents of your aspnetzero branch with this v14.1 scaffold.
    • Commit changes.
    • Tag the commit with something like aspnetzero-v14.1.

    Merge aspnetzero into dev

    git checkout dev 
    git merge aspnetzero 
    
    • Again, you’ll face conflicts. This is where your real work begins resolve all conflicts carefully.
    • Make sure to review breaking changes and update your project accordingly.

    This approach preserves full Git history. After merging, your dev branch becomes your main development branch, now upgraded to 14.1. You’ll be able to repeat this upgrade process in the future using the same branch strategy. You can delete the migrate branch after merging it to dev.

    Many thanks for the reply. Please can you tell me what I'm missing. I am already using git. So my project is in my main branch.

    So if I do this:

    checkout -b dev checkout -b aspnetzero (delete everything in this branch and commit) (download 14.1 to this branch and commit) git checkout dev git merge aspnetzero keep aspnetzero for next time so I can just merge it again

    I am just trying to understand

    1. How your way preserves my previous git history if I am copying the current files into migrate from another repo?
    2. Will the above way work, or is it different, am I missing something? I suspect the above might preserve my previous history and your way might not?????

    Regards

    Phil

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

    My above suggestion doesn't work. I'm just trying to understand how to keep my existing git change history on my project. Don't think your method does that?

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

    Hi @philipcj

    The purpose of the aspnetzero branch in this strategy is not to store your custom code, but to hold a clean version of AspNet Zero (base framework only). You don't develop on it.

    Here’s how your real project’s history is preserved:

    • Your actual project, with full commit history, lives in your main Git repository (probably on the main or master or dev branch).
    • The aspnetzero branch is created from a clean scaffold, and future clean scaffolds are committed there too.
    • By merging aspnetzero into dev, you bring in the new base changes, and resolve conflicts manually in dev, where your full history is intact.
    • At no point do you copy-paste your actual project into another repo or throw away its history.

    While performing these operations, you need to create a branch to preserve the git history and you must stay in the same repository.

    In short when you copy your project files into the migrate branch and commit them, you are not losing history. Instead, you are creating a single, clean commit that represents all of your customizations relative to the clean base. The history is preserved because the dev branch you work on will be a descendant of this process, and Git tracks every merge and commit from that point forward.

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

    Hi

    The reason for the confusion is that https://docs.aspnetzero.com/aspnet-core-mvc/latest/Version-Updating says create a new repository.

    I know I don't have much history in my project yet but I still wanted to understand how to do things correctly. My other asp.net zero projects - I created the aspnetzero branch when the project was created, which made it a lot easier to upgrade.

    Its a shame the documentation didn't tell me to do this to begin with, during getting started, or if it did, I missed it.

    Thanks I'll have a look at this. I think I might be ok now.

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

    Hi @philipcj

    We are glad your problem is solved. Yes, you are right. The first step under the "Existing Projects" heading is to create a new repository. This may cause confusion. I will create an issue to fix this. Thank you.

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