As many others I've on occassions spend some time struggling with packages in Sitecore. Especially with large packages, the scaling of the build-in packager doesn't seem optimal (at least in versions prior to 18.104.22.168), and when running through a webbased environment the entire installation process of a large package could easily fail do to browser / IIS timeouts.
All in all, I must admit to having been a bit annoyed with the entire webbased architecture of the packager - it was difficult to generate a package as part of an automated build-process, it was difficult to work with programmatically and as mentioned, it would crash often (it does seem to look somewhat better in Sitecore 5.3). So naturally I set out on a small quest to make my own console-based packager for Sitecore, however still based on the same package format (zip files with a mixture of files and xml-items). The goal of this tool was to run in a build-test enviroment for packages doing the following:
- After a new compilations of the components of a package is completed, extract the items and files necessary and make a package automatically
- Automatically install a number of packages on a dev-server to prepare it for regression-testing.
- A tool for manually syncronising certain items in Sitecore
However for the second task I did manage to create a small, but ugly, tool that could assist in manually installing packages (the ordinary packager crashing was a good motivation here).
Since I never completed the tool, I won't put it here for download, but let me just share the code-bit that uses the Sitecore webservice (located at "/sitecore/shell/webservice/service.asmx") for updating items. Perhaps it will be of use to someone out there facing the same problems as I was.
To manually install items extract the items from a sitecore (5.2) package using a zip-program. Then run this code on the folder containing the items.
string importpath = args;
ws.Credentials c = new SitecoreItemExport.ws.Credentials();
c.UserName = Properties.Settings.Default.Username;
c.Password = Properties.Settings.Default.Password;
ws.VisualSitecoreService service = new SitecoreItemExport.ws.VisualSitecoreService();
List<String> Paths = new List<string>();
GetPaths(importpath, ref Paths);
foreach (string p in Paths.ToArray())
string xml = sr.ReadToEnd();
string db = "";
string id = "";
ExamineItem( p, ref db, ref id);
XmlNode xn=service.InsertXML(id, xml, false, db, c);
if (xn.InnerText == "ok") Console.WriteLine("Success: " + p);
else Console.WriteLine(xn.InnerText+" "+p);
The "ws" is a namespace pointing to a web service reference, the credentials used is the admin login for Sitecore and it uses the method "ExamineItem" for some simple string manipulation (getting the database and db-item-path from the file-path of the item xml file).