Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Upgrade existing solution with new release of framework #2709


User avatar
0
bilalhaidar created

Hello,

I am now running an application using the release of 2 versions before.

Now, in case I want to make use of the latest source code, I am thinking of the following strategy, please have a look at it and let me know if im missing something:

  1. Create a new project base on the latest release and using same company name and project name and project type.
  2. Backup my local files
  3. Copy and paste all files from the downloaded file and override all my local files (including sln files?)
  4. Bring back my files that I've added on top of the framework and put them again in the solution
  5. Merge common files (those that I have edited). Use the new file and add my changes to make sure anything new added is there
  6. Upgrade all nuget packages
  7. Build and Compile

Any step missing above? Shall I need to do any Update-Database? Shall I override the existing .sln files?

Many thanks Bilal


14 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    In this approach it is easy to make some mistakes I think. You can create the project with the same name and compare two solutions with a tool like WinMerger or a similar one and sync files.

    You can also use git for doing merge but I don't have much experience on that.

  • User Avatar
    0
    bilalhaidar created

    Oh okay, I will try that tool then and see how it goes.

    So I use the tool to see what new files were added in the new release and add them to my project or the other way around?

    What about nuget packages?

    Is there somewhere online a place where you show the files affected?

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Is there somewhere online a place where you show the files affected?

    For this, no actually there is no place.

    But this kind of tools shows the new files and also the files which are different in both solutions. So for nuget packages, you will see the difference in packages.config

  • User Avatar
    0
    JeffMH created

    I feel like I need to make a video explaining how I am doing the merging. I see these steps and I cringe. I am just not sure I have the time to do that.

    Read my post on GitHub again. I can't say how strongly I believe you have to use your source control's merging capabilities. You ask which files have changed, I know that because my source control system tells me what changed. It already knows how to merge files and helps you make those decisions. You have to take advantage of that system in my opinion. I am probably 3 or 4 versions behind, but merging would take me probably just a few hours at most. I think I could get it done within a day for sure (minus testing time).

    Sorry if I sound overly opinionated on this subject. I just believe your experience would be so much better doing it this way. I will hop off my soap box now.

  • User Avatar
    0
    bilalhaidar created

    The point is I use TFS and not git.

    OK, I will give this a try. Can you guide me through an "Effective" article or video on basics needed before using Git?

    Thanks

  • User Avatar
    0
    JeffMH created

    That's ok. This should work the same in TFS. You can Merge down in TFS without ever merging "up".

    So if you create the very root branch from the Zip file downloaded (absolutely no changes). Then immediately after you commit that, branch to "Framework".

    Then, each time you get a new ZipFile from AspNetZero site, you just go to the Framework Branch, and unzip the file. in GIT, I delete everything, then unzip it. That way if they have deleted any files, I get that also. in TFS, this may be the only complication. You may need to do the following:

    1. Go to Explorer in the Framework Branch.
    2. Delete everything (do not checkout from TFS yet).
    3. Unzip everything.
    4. Run TFS command line to pend changes. I would have to remember how to do this.

    Then, check in. Once that's done, you merge back to your Master branch. NEVER merge into the framework branch. Framework branch is always just the contents of the ZipFile. Then, when you merge, you should see conflicts where things have changed. Just a normal code merge at that point. Something you can undo, and rollback.

    I will find the commands for #4 tomorrow. I have a batch file in my old code somewhere that does it.

  • User Avatar
    0
    bilalhaidar created

    Hi Jeff,

    I decided to pause on my project (although I will be losing few days) to learn Git and how to use Git in VS 2015. I guess this is better for later.

    I read again your post on GitHub. I understand all details. I have a question when you merge from Framework-Master to Master (or another branch) using command line or VS 2015, as you know new Framework files will not include any changes I've made to files in the Framework, so my question, will Git (command line or S) tell you those lines are missing from the files you are merging from, do you want to include them or, remove them, etc.?

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Actually that approach offered by one of our clients.

    For our own development we use GitHub and it handles merging branches, shows conflicts very well but this is not the same case with yours.

  • User Avatar
    0
    JeffMH created

    I actually Use Visual Studio to resolve my GIT conflicts. So it's almost the exact experience I had with TFS. I run the GIT commands to merge on the command line, then go to VS and open Team explorer, and Click Changes. It shows you the merge conflicts and let's you fix them there. At least it works with vsts online. I assume it may work the same with GitHub.

    Remember, Framework-Master will only have downloaded files. So it will never have changes that you manually made. You want GIT to just track changes that the AspNetZero guys made. Make sense? Then, once you merge from Framework-Master branch to your branch, your merging their changes into your changes. It works out perfectly. There are some manual steps after merge, like upgrading Nuget on any projects you added to the solution, moving around migrations, etc. But mostly pretty painless.

    Good luck, you won't regret moving to GIT. It took my a while to make the plunge, but wow am I glad I did!

  • User Avatar
    0
    bilalhaidar created

    Hi Jeff,

    Thanks for the hints.

    So now, I am using VS Git with online VS repository. I appreciate if you can be a bit patient and follow up with me on this process.

    1. Downloaded a fresh copy of the aspnetzero 2 releases before.
    2. Check-in the code to online repo
    3. Checked out the master into "Framework" branch
    4. Pushed the "Framework" branch to the online repo. >> Now I have 2 branches online and 2 branches locally <<
    5. I checked out a new branch called "Dev"
    6. I added all my files and folders (That I have already worked on previously) while working on "Dev" branch

    Now, I will work on the following steps:

    1. Push Dev to server so that I can track Dev online (I need to open the same solution from another PC, so I need Dev to be part of online repo)
    2. Check out local "Framework" branch
    3. Download latest release of aspnetzero
    4. Override all files in "File Explorer" while "Framework" branch is checked out
    5. Push local Framework to server Framework to update server branch
    6. Check out to local "Dev" branch
    7. Merge from local "Framework" to local "Dev" (git merge)
    8. Go to VS to check changes and see how to resolve conflicts
    9. Upgrade nugets & compile
    10. Run app and make sure all is working fine

    Is the plan ok so far?

    One more thing, do I need to run Update-Database when I upgrade to the latest release? Or no need?

    Finally, if I want to reflect all these changes to local branch master, I merge into master from local dev?

    Many thanks

  • User Avatar
    0
    JeffMH created

    Quick question. The ZipFile you checked into Framework-Master, is it the same version of AspNetZero you have been using on your current code?

    If not, you will need to reset things. Because you need to base your current changes off the code that was branched in Framework-Master. So this first time, what you need to do is take the new solution from AspnetZero, and manually copy your changes into that new solution. This was, your changes are now based off the new code. This way, as you download new versions, the merges will happen right.

    If you did have the original file, then you would want to make sure you used the code you originally based your solution on to be the start of Framework-Master.

    Where is a whiteboard when you need one lol.

  • User Avatar
    0
    bilalhaidar created

    Hi Jeff,

    Yes, I downloaded a Zip File with the same version I was using. Pushed it to Framework-Master on origin, is this correct?

    The rest of "will do steps" are ok?

    Thanks

  • User Avatar
    0
    JeffMH created

    On Step 4, I delete all the files in the File Explorer, I just don't unzip and override. You may have untracked files, and they may have removed files from the solution also, so I do that. GIT will understand if you delete a file, then add it back into the directory, that it was an edit, not a delete and add.

    Other than that, yes, looks about right to me.

  • User Avatar
    0
    bilalhaidar created

    Hi Jeff, Great news! I followed the steps above and also on Step4 deleted all existing files and everything worked fine and smooth.

    Now I have the following branches: 1- Dev 2- Master 3- Framework

    Same branches on the server.

    The Framework branch is now upgraded to v3.3.0.

    Now, my work basically revolves around Dev. I will check out the Dev branch on the second machine to get all changes there also.

    During the merge process I had only a few changes. It seems any additions or subtractions are dealt with automatically. Only conflicts on the same line need intervention from me. All of my changes were preserved when I merged from Framework to Dev.

    That was a lovely day learning Git that fast and applying it. I will be writing a small blog post on the steps involved in detail so that I dont forget them for next time and even others might find it helpful also to be able to upgrade to the latest releases.

    Many thanks Jeff and Ismail.