Project 2 Sitecore Copier

Challenge:

Howdy my dear readers, I hope you must be doing great!

Yes, I’m back here to write a new blog post after so long time. Sorry for not sharing anything with you since so long. But got busy with lot of bits and pieces. But it’s good to be busy, the busier you are the more you have to share!

So, keep visiting – going to share more with you in upcoming days! [Free advice: You can subscribe to this blog via EMAIL SUBSCRIPTION box given in right side – which means that whenever any new post gets posted here, you will get an email!]. So, here we go…

In Sitecore world we all Sitecore developers, spend a lot of time crafting solutions for our clients. And we all use Visual studio for doing that, Whenever we start any new project on Sitecore, first and foremost thing we do is create a Sitecore solution. Now, there are two approaches to set up a Sitecore Solution:

  1. Single directory : Here Your Project files, Sitecore files, and everything resides under same directory
  2. Separate directory : Here you separate your Project files and Sitecore files [Kind of Single Responsibility]

For a longer period, I’ve worked on #1. But since sometime, I’ve been working on #2 — And trust me, It is the best structure to follow.

Luckily, Lot of great minds have already penned down on this. So, rather than reinventing the wheel, will share the links with you:

  1. http://seankearney.com/post/Visual-Studio-Projects-and-Sitecore
  2. http://jockstothecore.com/setting-up-a-sitecore-solution-part-1-visual-studio-and-projects/
  3. http://www.hhogdev.com/products/team-development-for-sitecore/overview.aspx
  4. http://stackoverflow.com/questions/22694411/what-is-the-best-way-to-set-up-your-development-environment-for-sitecore
  5. http://www.cmssource.co.uk/blog/2012/June/basic-sitecore-development-tutorial-part-1-introduction
  6. http://www.sitecore.net/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2010/09/create-a-visual-studio-2010-project-for-a-sitecore-solution.aspx
  7. https://www.youtube.com/watch?v=P4iuck3A0J0
  8. http://theagilecoder.wordpress.com/2013/01/05/source-controlling-sitecore-tds-project-configuration-basics/
  9. https://github.com/Sitecore-Community/sample-sitecore-mvc
  10. http://varunvns.wordpress.com/2014/06/21/benefits-of-setting-up-sitecore-developer-box-loosely-coupled/
  11. http://varunvns.wordpress.com/2014/06/03/setup-sitecore-in-developer-box-in-less-than-5-minutes/

Convinced that you should approach#2 only? Good! If you are using Approach#1 – Then this post might not be for you. But I’m curious to know why you are still using approach#1.

If you are approach#2 guy [Like me!] then please keep reading:

So, at a quick glance, here’s how approach#2 looks like [Just a note : Physically, both resides in a same box]:

P2S

Now, to copy/publish your files from project to Sitecore you need to have some way like:

  1. Visual Studio Publish – Free, Refer Varun’s blog for detailed instructions
  2. TDS – Team Development for Sitecore — A Must have tool for every Sitecore Developer — But its paid. [I believe it’s worth And at times it’s funny to know that few companies even though they don’t have budget constraint they don’t purchase tools for developers. It’s like sending your army to win a fight without guns/arms!]

So, now you are using approach#2 with either of the approach since so long. One thing you must’ve faced that whatever small change you do, You’ve to publish/Build to copy that file to your Sitecore directory. So, you can test your change. Now, this works perfect for all files which needs to be compiled/restarts your worker process for example .cs, .config, CodeBehind aspx etc.

But when you are working on integrating UI part [CSS, JS, aspx,ascx] or at times CodeFile/Single File Model aspx page. Then it doesn’t makes sense to do a Publish/Build. Because doing that will take lot of your time.

Let’s see how it works as of now:

  1. Developer updates CSS/JS/ASPX/ASCX – Following Single File Model/CodeFile under project directory
  2. To see the changes publish it, Which copies all files along with his/her change. And it restarts Sitecore
  3. Invoke Sitecore
  4. Test the change
  5. Found something is not working
  6. Repeat Step 1-4 till Everything works

Step 1-4 should roughly take 60 seconds. Now, let’s take an example you are working on some JavaScript integration. And you have to repeat step 1-4 TEN times. Which is equal to 600 Seconds. Too much right? And mainly at times when you are working on strict deadlines project you can’t wait that much to see your JS changes in action!

Same feeling?! I also had the same feeling, and thought to search something which can help me to do this rapidly. Did a quick search and found this : CopySauce

http://www.igloo.com.au/blog/copysauce-igloos-sitecore-development-utility/ [While I’m writing this their Site is not working. It may come up soon]

Downloaded it and started configuration. Somehow, I can’t configure it [You’ve been able to configure it?]. After trying a lot, I gave up and thought to write my own

And that’s how Project2SitecoreCopier utility came in to this world!

We’ve been using this since so long, for our internal teams. Today, thought to iron a bit and share it with you. So, now let’s go back and see the last example again:

 

  1. Developer updates CSS/JS/ASPX/ASCX – Following Single File Model/CodeFile under project directory
  2. Project2SitecoreCopier will copy the file without restarting your Sitecore instance
  3. Test the change
  4. Found something is not working
  5. Repeat Step 1-4 till Everything works

Step 1-4 should roughly take 3 seconds. Now, let’s take an example you are working on some JavaScript integration. And you have to repeat step 1-4 TEN times. Which is equal to 30 Seconds. Sounds exciting!? It’s 95% decrease

Sounds exciting!? Eager to use it? Easy, easy, let’s see how to get it and use it!

 

Solution:

Main Features

  • Sync Project files with Sitecore
  • Configurable via Config file
  • Only valid extension files will get copied
  • No other dependencies, Just need .NET Framework 3.5 installed
  • Lightweight
  • Switch off, when you don’t need it
  • Show full log of data
  • And it works!

Screen shots:

2014-08-04 00_00_29-SitecoreBasics.Project2SitecoreCopier [BETA]

How it works?

Technically, we’ve written a Windows application, which keeps watch on Project directory and it any of the valid extension file gets updated/created it copies it to configured Sitecore directory. Simple!?

You can explore a configuration file from <InstalledDirectory>\SitecoreBasics.Project2SitecoreCopier.exe.exe.config[Just a note : Please read all comments given in that file, It should help you to configure it]

System requirements

  1. .NET 3.5

How to use?

  1. Download Project2SitecoreCopier from here : http://1drv.ms/XgJcHD
  2. Extract Zip file at your desired location
  3. Do modifications in <InstalledDirectory>\SitecoreBasics.Project2SitecoreCopier.exe.exe.config as per your environment
  4. Double click on SitecoreBasics.Project2SitecoreCopier.exe [Just a note : If your configurations are not correct, it will give you an error, please correct it and then give it a go again]
  5. Click on Run!
  6. And see it in action!

RoadMap

As you can see this utility is launched in BETA stage. I wanted to include following features within it:

  1. Make it a SIM Plugin
  2. Parse TDS project file. So, you no need to do any configurations manually
  3. Support Multiple projects via Single Configuration file
  4. Log everything
  5. Stop Button
  6. Tweak UI a bit
  7. GitHub project
  8. Installer

And so on… But I followed two rules here:

  1. Best is the enemy of the good! — Most of the times, to do something best, we even don’t do the good  🙂 So, This is Good. But best is yet to come!
    1. YAGNI – You aren’t gonna need it [http://www.hanselman.com/blog/AnalysisParalysisOverthinkingAndKnowingTooMuchToJustCODE.aspx]. So, before investing more time on features listed in ROADMAP, thought to get your views. What you would like to have first?!

I would like to hear from you

Feel free to post your suggestions/comments/bugs in comments section.

Icon credits : http://www.softicons.com/folder-icons/alumin-folder-icons-by-mike-demetriou/sync-icon

Happy Sitecoring! 🙂

8 thoughts on “Project 2 Sitecore Copier

  1. Hey Kiran,
    Igloo (where CopySauce was created) has recently changed names. I’m finding out about the status of their redirects now….but that’s why the link is down.

    In the meantime, CopySauce can still be downloaded from the creator’s Github page.
    https://github.com/dnicolson/CopySauce/releases/tag/v2.0.2

    I would love to hear what problems you had with configuration, and what features may have been missing. There’s also documentation within that download, and if you’re using TFS for source control, you can use this tip (https://github.com/dnicolson/CopySauce/issues/1).

    Thanks,
    Sean

  2. If you are using VS2013 you can right click a file/folder and publish just those items (you need to have OneClick publish setup). It doesn’t work so well for config files with transformations (it copies ALL files across) but works well for JS/CSS/ASPX/ASCX etc. You can also use the ALT+;,ALT+P shortcut.

    I’ll take a look at this though, it looks interesting.

  3. Pingback: CopySauce, a file Copying Utility for Sitecore Development | Sean Holmesby

    1. kiranpatils

      Hello Martijn,

      Thanks for trying it out. Yes, I can reproduce your reported issue. Will fix it and notify you as soon as I’m done with it.

      Thanks,
      Kiran

Leave a comment