Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonny Irwin 91 posts 153 karma points
    Feb 20, 2013 @ 13:29
    Jonny Irwin
    0

    Packaging with courier command line

    I'm trying to do some simple packaging using the courier command line (on umbraco 4.11.4 with Courier_2.7.3_2.7.3.39) using the following:

     

    private static void Main(string[] args)
            {
                var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
                TypeResolver.LoadAssembliesIntoAppDomain(Path.Combine(baseDirectory, "Plugins"), "*.dll");
                Context.Current.SettingsFilePath = Path.Combine(baseDirectory, @"Config\courier.config");
    
                // This is the directory where revisions are located.
                Context.Current.BaseDirectory = @"C:\Temp\Courier\Revisions";
    
                Context.Current.HasHttpContext = false;
    
                var repositoryStorage = new RepositoryStorage();
                var source = repositoryStorage.GetByAlias("Source");
                repositoryStorage.Dispose();
    
                var engine = new RevisionPackaging("TestRevision") {Source = source};
                engine.AddAllProvidersToQueue(true);
                engine.Package();
            }

    I have a simple courier.config, with the only items of significance being my repository:

     

    <repositories>
        <repository name="Source" alias="Source" type="CourierWebserviceRepositoryProvider" visible="true">
          <url>http://test.local</url>;
          <login>admin</login>
          <password>1234</password>
        </repository>
      </repositories>

    The code executes ok and everything seems initialized ok until I get to engine.Package() at which point I get the following exception:

    System.Collections.Generic.KeyNotFoundException was unhandled

      HResult=-2146232969

      Message=The given key was not present in the dictionary.

      Source=mscorlib

      StackTrace:

           at System.Collections.Generic.Dictionary`2.get_Item(TKey key)

           at Umbraco.Courier.Core.PersistenceManager.get_Default()

           at Umbraco.Courier.RepositoryProviders.Local.OpenSession(String key)

           at Umbraco.Courier.Core.Packaging.RevisionPackaging.#Gb()

           at Umbraco.Courier.Core.Packaging.RevisionPackaging.Package()

           at Courier2.Program.Main(String[] args) in c:\Users\Jonny.Irwin\Documents\Visual Studio 2012\Projects\Courier2\Courier2\Program.cs:line 29

           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

           at System.Threading.ThreadHelper.ThreadStart()

      InnerException: 

     

    Has anyone any ideas?  I have my test site running on SQL CE in case that's an issue.

     

     

     

  • Jonny Irwin 91 posts 153 karma points
    Feb 20, 2013 @ 16:26
    Jonny Irwin
    0

    As further information:

    • Changing the database to sqlexpress gives the same kind of error.
    • I load bothUmbraco.Courier.Persistence.V4.NHibernate.dll and Umbraco.Courier.Persistence.V4.dll into the AppDomain.
    • When I check the PersistenceManager, I can see 1 PersistanceProvider loaded: the Peta Poco provider
  • Per Ploug 865 posts 3491 karma points MVP admin
    Feb 21, 2013 @ 10:21
    Per Ploug
    0

    Hmm, you should remove the Umbraco.Courier.Persistence.V4.dll as that is not near to being done yet.

    the issue is that you are trying to use the Nhibernate datalayer, but you need all the nhibernate dependencies in place, have a look in the standard courier zip hotfix for all the dependencies that courier needs to work with the nhibernate provider. 

    Also, are you absolutely sure that it finds the config file, and connects properly to the repository, because if you connect to a remore repository, it shouldnt need any local persistence layer, as that is all handled on the server, not in the client.

    /Per

  • Jonny Irwin 91 posts 153 karma points
    Feb 21, 2013 @ 14:18
    Jonny Irwin
    0

    It is definitely finding my config file and connecting to it as I can see all the items when they have been added to the queue before trying to package.

    I have the following files in my solution which I have taken from a version of the console app that you provided me with quite some time ago.

    In my plugins folder i have the following:

    • Umbraco.Courier.DataResolvers.dll
    • Umbraco.Courier.Providers.dll
    • Umbraco.Courier.RepositoryProviders.dll
    • Umbraco.Courier.uComponents.dll
    In my bin/debug folder I have:
    • businesslogic.dll
    • interfaces.dll
    • Microsoft.ApplicationBlocks.Data.dll
    • MySql.Data.dll (I know this won't be needed)
    • Umbraco.Courier.Core.dll
    • umbraco.DataLayer.dll
    • Umbraco.Licensing.dll
    Using this setup, I can't see any PersistenceProviders loaded in the PersistenceManager, but as you said, I shouldn't need this.
    I have used the default courier.config apart from adding my repository above:
    <?xml version="1.0"?>
    <configuration>
      <security>
        <filters>
          <ipfilter>
            <allow>*</allow>
          </ipfilter>
          <userfilter>
            <allow>*</allow>
            <!--<deny>editor</deny>-->
          </userfilter>
        </filters>
      </security>
      <settings>
        <!--
            Enable short filenames for courier files
            <enableShortFileNames>False</enableShortFileNames>
            
            Enable the update pull dialog for courier
            <contextMenuEnableUpdate>False</contextMenuEnableUpdate>
            -->
        <!-- This strips the resouces from courier files, resources are still transfered as normal files
                But if you depend on modifying resources from the courier file, in memory, you might want to turn this off (set to "False")-->
        <stripResourcesFromCourierFiles>True</stripResourcesFromCourierFiles>
        <!-- Turn off Base64 encoding for resource transfers-->
        <disableBase64Encoding>false</disableBase64Encoding>
        <debugMode>true</debugMode>
        <!-- 
                Enable error logging in /app_data/courier/revisions/log.txt
                <debugMode>true</debugMode>
                
                Generate a mindmap of extracted revisions
                <mapGraph>true</mapGraph>
            -->
        <!-- overwrite modes is either Always|Never|Compare -->
        <overwrite>
          <resources>Compare</resources>
          <items>Compare</items>
          <dependencies>Compare</dependencies>
        </overwrite>
      </settings>
      <repositories>
        <repository name="Source" alias="Source" type="CourierWebserviceRepositoryProvider" visible="true">
          <login>admin</login>
          <password>1234</password>
        </repository>
        <repository name="472" alias="472" type="CourierWebserviceRepositoryProvider" visible="true">
          <url>http://472.local</url>;
          <login>admin</login>
          <password>1234</password>
        </repository>
      </repositories>
      
      <itemProviders>
        <folderItemProvider>
          <include>
            <!--<folder>~/media/assets/somefolder</folder>-->
          </include>
        </folderItemProvider>
        <fileItemProvider>
          <files>
          </files>
        </fileItemProvider>
        <documentTypeItemProvider>
          <!-- Include all avaiable templates as dependencies, if false, only the current standard template is included -->
          <includeAllTemplates>false</includeAllTemplates>
          <!-- By default we won't add the built-in datatypes as dependencies, if needed, they can be removed from the list below -->
          <!-- Only datatypes which are installed as standard, and does not have any settings are ignored -->
          <!-- to add, find the datatype in the umbracoNode table and copy its uniqueId value to a node below-->
          <ignoredDataTypes>
            <add key="contentPicker">A6857C73-D6E9-480C-B6E6-F15F6AD11125</add>
            <add key="textstring">0CC0EBA1-9960-42C9-BF9B-60E150B429AE</add>
            <add key="textboxmultiple">C6BAC0DD-4AB9-45B1-8E30-E4B619EE5DA3</add>
            <add key="label">F0BC4BFB-B499-40D6-BA86-058885A5178C</add>
            <add key="folderbrowser">FD9F1447-6C61-4A7C-9595-5AA39147D318</add>
            <add key="memberpicker">2B24165F-9782-4AA3-B459-1DE4A4D21F60</add>
            <add key="simpleeditor">1251C96C-185C-4E9B-93F4-B48205573CBD</add>
            <add key="truefalse">92897BC6-A5F3-4FFE-AE27-F2E7E33DDA49</add>
            <add key="contentpicker">A6857C73-D6E9-480C-B6E6-F15F6AD11125</add>
            <add key="datepicker">5046194E-4237-453C-A547-15DB3A07C4E1</add>
            <add key="datepickerWithTime">E4D66C0F-B935-4200-81F0-025F7256B89A</add>
            <add key="numeric">2E6D3631-066E-44B8-AEC4-96F09099B2B5</add>
          </ignoredDataTypes>
        </documentTypeItemProvider>
        <mediaItemProvider>
          <!-- Changed to false in 2.1.1 -->
          <includeChildren>false</includeChildren>
          <includeParents>false</includeParents>
        </mediaItemProvider>
        <documentItemProvider>
          <includeParents>false</includeParents>
        </documentItemProvider>
        <!-- Add the fully classified Class name to ignore a provider from loading... -->
        <ignore>
          <!--<add>my.namespace.*</add>-->
        </ignore>
      </itemProviders>
      <itemDataResolvers>
        <files>
          <!-- add new datatype elements for data types that stores files as a path ex: /meda/223/file.png -->
          <add key="Upload">5032a6e6-69e3-491d-bb28-cd31cd11086c</add>
          <add key="Ucomponents-Filepicker">318a9c2e-3966-4979-8c1d-575c5d5f669b</add>
        </files>
        <contentPickers>
          <!-- add new datatype elements for data types that stores page ids (ex: "1242" or "1726,2362,2323") -->
          <add key="contentPicker">158aa029-24ed-4948-939e-c3da209e5fba</add>
          <add key="ultimatePicker">cdbf0b5d-5cb2-445f-bc12-fcaaec07cf2c</add>
          <add key="Ucomponents-XpathCheckboxlist">d2d46927-f4f8-4b1b-add7-661cc09a0539</add>
          <add key="Ucomponents-XpathDropdownlist">57a62843-c488-4c29-8125-52f51873613e</add>
          <add key="Ucomponents-AutoComplete">31aa0d5c-f8e1-4cdc-a66e-c7f8c09498ef</add>
        </contentPickers>
        <mediaPickers>
          <!-- add new datatype elements for data types that stores media ids (ex: "1242" or "1726,2362,2323") -->
          <add key="mediaPicker">EAD69342-F06D-4253-83AC-28000225583B</add>
          <add key="damp2">ef94c406-9e83-4058-a780-0375624ba7ca</add>
        </mediaPickers>
        <keyValuePrevalueEditors>
          <!-- Prevalue editors that store values as a key value pair in the built-in umbracp prevalue storage, identified by their full class-name -->
          <add key="KeyValuePrevalueEditor">umbraco.editorControls.KeyValuePrevalueEditor</add>
        </keyValuePrevalueEditors>
        <localLinks>
          <!-- Propertytypes that CAN contain locallinks (like the ones inserted with TinyMCE) -->
          <add key="TinyMCE3">5e9b75ae-face-41c8-b47e-5f4b0fd82f83</add>
          <add key="TextboxMultiple">67db8357-ef57-493e-91ac-936d305e0f2a</add>
          <add key="Textstring">ec15c1e5-9d90-422a-aa52-4f7622c63bea</add>
          <add key="Simple Editor">60b7dabf-99cd-41eb-b8e9-4d2e669bbde9</add>
        </localLinks>
        <macros>
          <!-- Propertytypes that CAN contain macro mark-up (like the ones inserted with TinyMCE) -->
          <add key="TinyMCE3">5e9b75ae-face-41c8-b47e-5f4b0fd82f83</add>
          <add key="TextboxMultiple">67db8357-ef57-493e-91ac-936d305e0f2a</add>
          <add key="Textstring">ec15c1e5-9d90-422a-aa52-4f7622c63bea</add>
          <add key="Simple Editor">60b7dabf-99cd-41eb-b8e9-4d2e669bbde9</add>
          <add key="Macro Container">474FCFF8-9D2D-11DE-ABC6-AD7A56D89593</add>
        </macros>
      </itemDataResolvers>
      <macroPropertyTypeResolvers>
        <contentPickers>
          <!-- Macro Property Types, that store Content IDs, to link to media or content -->
          <add key="Media Current">mediaCurrent</add>
          <add key="Content Subs">contentSubs</add>
          <add key="Content Random">contentRandom</add>
          <add key="Content picker">contentPicker</add>
          <add key="Content tree">contentTree</add>
          <add key="Content All">contentAll</add>
        </contentPickers>
      </macroPropertyTypeResolvers>
      <resources>
        <!-- files which should not added at any time-->
        <ignore>
          <add>/bin/*.pdb</add>
          <add>/bin/*.xml</add>
          <add>/bin/AjaxControlToolkit.dll</add>
          <add>/bin/Antlr3.Runtime.dll</add>
          <add>/bin/App_Browsers.dll</add>
          <add>/bin/App_global.asax.dll</add>
          <add>/bin/businesslogic.dll</add>
          <add>/bin/Castle.*</add>
          <add>/bin/ClientDependency.Core.dll</add>
          <add>/bin/cms.dll</add>
          <add>/bin/controls.dll</add>
          <add>/bin/CookComputing.XmlRpcV2.dll</add>
          <add>/bin/Examine.dll</add>
          <add>/bin/FluentNHibernate.dll</add>
          <add>/bin/htmlagilitypack.dll</add>
          <add>/bin/ICSharpCode.SharpZipLib.dll</add>
          <add>/bin/interfaces.dll</add>
          <add>/bin/Iron*.dll</add>
          <add>/bin/log4net.dll</add>
          <add>/bin/Lucene.Net.dll</add>
          <add>/bin/Microsoft.*.dll</add>
          <add>/bin/MySql.Data.dll</add>
          <add>/bin/NHibernate.*</add>
          <add>/bin/RazorEngine.*.dll</add>
          <add>/bin/System.Web.*</add>
          <add>/bin/TidyNet.dll</add>
          <add>/bin/Umbraco.Courier.*</add>
          <add>/bin/umbraco.DataLayer.dll</add>
          <add>/bin/UrlRewritingNet.UrlRewriter.dll</add>
          <add>/bin/umbraco.dll</add>
        </ignore>
      </resources>
      <!-- which types of relations should be supported by courier -->
      <!-- Relations are only supported between content and media out of the box -->
      <relations>
        <add>relateOnCopy</add>
        <!-- <add></add> -->
      </relations>
    </configuration>
    I have tried running this against a Umbraco 4.7.2 test site aswell (swapping the 4.11.4 dll's for the 4.7.2 ones in my bin/debug folder) and got the same exception.
  • Jonny Irwin 91 posts 153 karma points
    Feb 21, 2013 @ 14:22
    Jonny Irwin
    0

    I forgot to mention that my test sites for packaging are just blank sites with the business starter kit installed.  I have then installed Courier_2.7.3_2.7.3.39 on these (I assume Courier needs to be installed on the sites so the webservice etc. is installed).  I have then stuck my umbracoCourier.lic file in the bin of these sites.

  • Jonny Irwin 91 posts 153 karma points
    Feb 21, 2013 @ 17:39
    Jonny Irwin
    100

    So I now have this packaging.  It appears that the latest version of Courier requires both the Source and the Destination properties of the RevisionPackaging instance to be set.  Previous versions of Courier allowed only the Source to be set as shown in the example on https://github.com/umbraco/Courier/tree/master/Samples/Umbraco.Courier.ExtractionConsole

Please Sign in or register to post replies

Write your reply to:

Draft