-
Visual Studio Solution at Sitecore Projects - Avoiding IIS restarts with Robocopy in a Post Build event
April 11, 2015 Rodrigo Peplau 2
As very well described by Sean Kearney at this great post, there are two ways to setup a Sitecore solution on Visual Studio for development:
1) Your solution, and code, is fully immersed in the Sitecore web site;
2) Your solution, and code, is outside of Sitecore’s web site and you use some post build process to deploy.His post supports second option, which indeed has advantages over the first, however a huge drawback (specially for those without SSD) makes our life harder: due to the post build deployment, IIS is constantly forced to restart on every build you make.
In order to handle that issue I’ve invested some time looking for a better way to deploy. What if I copy only the modified changes instead of everything? Perhaps I could often skip the files that causes restarts, such as DLLs and config files…
Robocopy
My solution lied on robocopy, for advanced file copying. At your website project on Visual Studio, put this command at the Post-build event command line box:
robocopy “$(ProjectDir).” “C:\inetpub\wwwroot\YourProject\Website” /E /FFT /XO
exit 0- Parameters:
- /E – Copies subdirectories;
- /XO – Excludes older files – this is the trick, skipping old files;
- /FFT – Assumes FAT file times (two-second precision) – this somehow interferes on how robocopy defines what is “older” to be copied;
- exit 0 – If we don’t add this to the end of the script, our Continuos Integration server breaks because robocopy returns a code different than “0” as success.
In my experience, even when you re-compile the solution without changing anything at the code, your IIS will not restart.
Categories: Development, Visual Studio
Best way to setup Active Directory Module in a Sitecore Solution Using Rules to replace spaces by dashes in Sitecore 7.5 in 3 simple steps
2 thoughts on “Visual Studio Solution at Sitecore Projects - Avoiding IIS restarts with Robocopy in a Post Build event”
Leave a Reply Cancel reply
- Parameters:
Proudly 10x Sitecore MVP!
(2016-2025)
Localization
Recent Posts
Recent Comments
- navan on Meet MVPinny: the AI-Powered Sitecore Assistant
- Adriana on Content generation with Sitecore Connect and ChatGPT
- NAVAN on Automatic Sitecore NuGet upgrades with Powershell
- Hedipo S Menezes on Corey Peplau wrote this - WFFM conflict with Unity DI and a lesson on how Sitecore community is so amazing
- Rodrigo Peplau on ERROR [Content Testing]: Cannot find PhantomJS executable at ' (...) /data/tools/phantomjs/phantomjs.exe'. Aborting screenshot generation.
Archives
- March 2025
- January 2025
- June 2024
- April 2024
- February 2024
- December 2023
- November 2023
- August 2023
- July 2023
- January 2023
- February 2022
- December 2021
- November 2021
- March 2021
- July 2020
- February 2020
- September 2019
- July 2019
- April 2019
- March 2019
- December 2018
- February 2018
- January 2018
- November 2017
- September 2017
- August 2017
- July 2017
- March 2017
- February 2017
- November 2016
- September 2016
- August 2016
- July 2016
- April 2016
- November 2015
- September 2015
- July 2015
- April 2015
- March 2015
- February 2015
Categories
- Actions
- Active Directory
- Analytics
- Architecture
- Bug fixing
- CDP/Personalize
- ChatGPT
- Content Edition Experience
- Content Hub
- Continuous Integration
- Dev
- Development
- Environments
- Experience Editor
- Experience Forms
- Front-end
- Hackathon
- Health Check builds
- Helix
- How To
- LDAP
- MVP
- MVP Summit
- MVPinny
- Phantom JS
- Powershell
- QA
- Richtext Editor
- Rules
- Security Provider
- SIF
- Sitecore 9
- Sitecore API
- Sitecore Community
- SItecore Connect
- Sitecore Modules
- Sitecore Rocks
- Sitecore Rule Processor
- Sitecore Symposium
- SPE
- SPE-only Alliance
- SPEAK
- SUG
- Support Ticket
- TDS
- Team City
- Uncategorized
- Upgrades
- Visual Studio
- WFFM
- Workflow
- XConnect
- xDB
- XM Cloud
Caro visitante de língua portuguesa: traduzirei meus posts na medida do possível. Caso você precise muito deste conteúdo em português, deixe um recado aqui no mural e priorizarei sua tradução.
Hey Rodrigo,
Nice post.
This is a common issue with Sitecore development. As a result, the tool I use is CopySauce.
You have full control to limit what copies over to your website, and it copies the files over when they’re saved….no need to even build.
You can find out more information here:-
http://www.seanholmesby.com/copysauce-a-file-copying-utility-for-sitecore-development/
– Sean