Migration using the source code

Topics: Administration, Installing Orchard
Oct 25, 2012 at 7:41 PM

I have an instance of Orchard that has been running for over a year.  After failing to upgrade it, I have decided to work with the source code.   Could anyone piont to a source offering some tips on how to integrating an existing Orchard web app instance with the source code?

I am thinking about duplicating Orchard\src\Orchard.Web, and modifying it.

Any tip will be greatly appreciated.

Oct 25, 2012 at 7:58 PM

First and foremost, back EVERYTHING up. Create a backup of the web files from your web server, and then backup your database. I have powershell scripts on github that automate this if you are interested in that (Orchard-Devops), but they only work if you are using SQL Server. 


  1. Clone the orchard source 
  2. Put any custom modules/themes into the Modules and Theme folders
  3. Open the Orchard.sln, for each custom module: do add existing project -> navigate to the csproj of the module
  4. Build, then F5 or Ctrl+F5 to run. 
  5. Fix any issues
  6. Once ready, open a console window, and run ClickToBuild.cmd  (others here deploy straight from VS, i've never tried that)
  7. Deploy the build to your web server. 

It would be a good idea to replicate your production site locally first, so you can test your migration process locally, or in a QA/Staging environment before you try it in production. Again, the devops scripts i mentioned make this process easy. They backup your web site and database into a .zip and a .bak, and then it's very easy to copy those locally and restore database using the .bak, and deploy the .zip to a local/QA/Staging IIS.

You should also commit any changes into your local clone, and push the whole thing to a private repo (Assembla/Bitbucket/etc). You can continue to pull changes from the Orchard codeplex repo and still merge them with your modifications (if any). 

Oct 25, 2012 at 8:25 PM

Thanks a lot for the detailed instructions. 

Is there anything that needs to be done with folder App_Data?  I thought that folder had important information such as database server connection string.


Oct 25, 2012 at 8:55 PM

Take a look in App_Data > Sites > Default

The "Settings.txt" contains SQL settings, site name, host/url info (for tenants), encryption and hashing info etc. - so yes, you will need this. If you are using MultiTenancy, there will be a directory for each Tenant in the Sites folder.

If you are using SQL CE, your database file will be in this folder as well ("Orchard.sdf").


I don't know if it will work, if you simply copy this folder in to a new instance, I've never tried that.

Oct 26, 2012 at 12:38 AM
Edited Oct 26, 2012 at 12:38 AM

Don't forget the media folder. And simply copying app_data to the new site works, yes. You may have to delete mappings.bin and cache.dat.

Oct 26, 2012 at 11:51 AM

Progress has been made thanks to all your help, but there is still some work.

When I run Orchard.Web in debug mode, I get the followin error:

The controller for path '/OrchardLocal/' was not found or does not implement IController.

According to a thread, this is expected.  I have gone to /Admin, and enabled UpgradeTo16.  I am wondering if there are some other things in the Modeules section that I need to do make it work.

Any tip will be greatly appreciated.


Oct 26, 2012 at 12:40 PM
Edited Oct 26, 2012 at 3:25 PM

Hallelujah! It is up to 1.6.

I am glad that I have taken this approach to upgrade from 1.3 to 1.6.  The pain is minimal with thanks to all your help.

Here are the steps based on all your kind tips and the online upgrading instructions:

  1. Use TortoiseHg to retrieve the latest version of Orchard.
  2. Build Orchard.Web to make sure everything works.
  3. Copy folder Media from the running instance.
  4. Copy folder app_data from the running instance. I also deleted mappings.bin and cache.dat per Bert’s advice.
  5. Run Orchard.Web, ignore an error, and go to /admin, enable UpgradeTo16.
  6. Go to UpgradeTo16 tab: upgrade everything; Migrate Menu > Migrate (I hit an error the first time, but tried it again later after navigating away, and it worked)

I did not make a copy of the database, so I worked on the same database as the running instance uses. I can bear with this bad idea that saves me time because:

  1. For this instance of Orchard, I can afford a downtime of a few hours at this point of time (Actually, it was never down).
  2. I have backup copy of the database which allows me to restore the original one in seconds if needed (it was never needed during this process, but was used during a prior attempt).


Marked as answer by zipswich on 10/23/2013 at 11:27 AM