{"id":25,"date":"2023-03-21T03:29:20","date_gmt":"2023-03-21T03:29:20","guid":{"rendered":"https:\/\/brunocm.azurewebsites.net\/?page_id=25"},"modified":"2023-03-21T05:07:03","modified_gmt":"2023-03-21T04:07:03","slug":"part-7-add-our-property-page-to-msi","status":"publish","type":"page","link":"https:\/\/brunocm.azurewebsites.net\/?page_id=25","title":{"rendered":"Part 7 &#8211; Add our property page to MSI"},"content":{"rendered":"<h1>Place our propertyPage into our MSI<\/h1>\n<p>In part 3, we created an MSI, you thought it was complex? This was just the beginning!<\/p>\n<p>As explained before, the complexity resides here in finding the base file location and its modification. Moreover, we will have to handle the cleanup of this file in case of removal.<\/p>\n<p>To achieve this, we will use the \u201cdirectorysearch\u201d feature of WIX to locate the file then some functions of the Wix utils toolbox to alter the XML file inline.<\/p>\n<p>We already locate the XmlStorage folder with:<\/p>\n<pre><span style=\"color: #0000ff;\">&lt;Property <\/span><span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"XMLSTORAGE\"<\/span> <span style=\"color: #ff0000;\">Secure<\/span><span style=\"color: #993300;\">=\"yes\"<\/span><span style=\"color: #0000ff;\">&gt;<\/span>\n     <span style=\"color: #0000ff;\">&lt;DirectorySearch<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"CheckSubDir\"<\/span> <span style=\"color: #ff0000;\">Path<\/span><span style=\"color: #993300;\">=\"[UIFOLDER]\"<\/span> <span style=\"color: #ff0000;\">Depth<\/span><span style=\"color: #993300;\">=\"0\"<\/span><span style=\"color: #0000ff;\">&gt;<\/span>\n       <span style=\"color: #0000ff;\">&lt;DirectorySearch<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"xml_storage_search\"<\/span> <span style=\"color: #ff0000;\">Path<\/span><span style=\"color: #993300;\">=\"XmlStorage\"<\/span> <span style=\"color: #ff0000;\">Depth<\/span><span style=\"color: #993300;\">=\"5\"<\/span><span style=\"color: #0000ff;\"> \/&gt;<\/span>\n     <span style=\"color: #0000ff;\">&lt;\/DirectorySearch&gt;<\/span>\n<span style=\"color: #0000ff;\">&lt;\/Property&gt;<\/span><\/pre>\n<p>Now, we\u2019ll add the following lines to locate the \u201cextensions\/forms\u201d subfolder with the \u201cCollectionResource.xml\u201d file within if it exists.<\/p>\n<pre><span style=\"color: #0000ff;\">&lt;Property<\/span> Id=\"EXTFORMFLD\"<span style=\"color: #0000ff;\">&gt;<\/span>\n   <span style=\"color: #0000ff;\">&lt;DirectorySearchRef<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"xml_storage_search\"<\/span> <span style=\"color: #ff0000;\">Parent<\/span><span style=\"color: #993300;\">=\"CheckSubDir\"<\/span> <span style=\"color: #ff0000;\">Path<\/span><span style=\"color: #993300;\">=\"XmlStorage\"<\/span> <span style=\"color: #0000ff;\">&gt;<\/span>\n     <span style=\"color: #0000ff;\"> &lt;DirectorySearch<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"extensions_fld_search\"<\/span> <span style=\"color: #ff0000;\">Path<\/span><span style=\"color: #993300;\">=\"Extensions\"<\/span> <span style=\"color: #ff0000;\">Depth<\/span><span style=\"color: #993300;\">=\"0\"<\/span> <span style=\"color: #0000ff;\">&gt;<\/span>\n         <span style=\"color: #0000ff;\">&lt;DirectorySearch<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"extforms_fld_search\"<\/span> <span style=\"color: #ff0000;\">Path<\/span><span style=\"color: #993300;\">=\"Forms\"<\/span> <span style=\"color: #ff0000;\">Depth<\/span><span style=\"color: #993300;\">=\"0\"<\/span> <span style=\"color: #0000ff;\">\/&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;\/DirectorySearch&gt;<\/span>\n   <span style=\"color: #0000ff;\">&lt;\/DirectorySearchRef&gt;<\/span>\n<span style=\"color: #0000ff;\">&lt;\/Property&gt;<\/span>\n<span style=\"color: #0000ff;\">&lt;Property<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"FRMCOLLRESS\"<\/span><span style=\"color: #0000ff;\">&gt;<\/span>\n   <span style=\"color: #0000ff;\">&lt;DirectorySearchRef<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"extforms_fld_search\"<\/span> <span style=\"color: #ff0000;\">Parent<\/span><span style=\"color: #993300;\">=\"extensions_fld_search\"<\/span> <span style=\"color: #ff0000;\">Path<\/span><span style=\"color: #993300;\">=\"Forms\"<\/span> <span style=\"color: #0000ff;\">&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;FileSearch<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"frmCollRess\"<\/span> <span style=\"color: #ff0000;\">Name<\/span><span style=\"color: #993300;\">=\"CollectionResource.xml\"<\/span> <span style=\"color: #0000ff;\">\/&gt;<\/span>\n  <span style=\"color: #0000ff;\"> &lt;\/DirectorySearchRef&gt;<\/span>\n<span style=\"color: #0000ff;\">&lt;\/Property&gt;<\/span><\/pre>\n<p>The result will be the creation of 2 properties containing respectively the path and the file name or false if the file is not found.<\/p>\n<p>Let\u2019s do this a second time to keep a reference to the original file.<\/p>\n<pre><span style=\"color: #0000ff;\">&lt;Property<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"FORMFLD\"<\/span><span style=\"color: #0000ff;\">&gt;<\/span>\n   <span style=\"color: #0000ff;\">&lt;DirectorySearchRef<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"xml_storage_search\"<\/span> <span style=\"color: #ff0000;\">Parent<\/span><span style=\"color: #993300;\">=\"CheckSubDir\"<\/span> <span style=\"color: #ff0000;\">Path<\/span><span style=\"color: #993300;\">=\"XmlStorage\"<\/span><span style=\"color: #0000ff;\"> &gt;<\/span>\n     <span style=\"color: #0000ff;\"> &lt;DirectorySearch<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"forms_fld_search\"<\/span> <span style=\"color: #ff0000;\">Path<\/span><span style=\"color: #993300;\">=\"Forms\"<\/span> <span style=\"color: #ff0000;\">Depth<\/span><span style=\"color: #993300;\">=\"0\"<\/span><span style=\"color: #0000ff;\"> \/&gt;<\/span>\n  <span style=\"color: #0000ff;\"> &lt;\/DirectorySearchRef&gt;<\/span>\n<span style=\"color: #0000ff;\">&lt;\/Property&gt;<\/span>\n<span style=\"color: #0000ff;\">&lt;Property<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"FRMCOLLRESSORIG\"<\/span><span style=\"color: #0000ff;\">&gt;<\/span>\n  <span style=\"color: #0000ff;\"> &lt;DirectorySearchRef<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"forms_fld_search\"<\/span> <span style=\"color: #ff0000;\">Parent<\/span><span style=\"color: #993300;\">=\"xml_storage_search\"<\/span> <span style=\"color: #ff0000;\">Path<\/span><span style=\"color: #993300;\">=\"Forms\"<\/span> <span style=\"color: #0000ff;\">&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;FileSearch<\/span> <span style=\"color: #ff0000;\">Id<\/span><span style=\"color: #993300;\">=\"frmCollRessOrig\"<\/span> <span style=\"color: #ff0000;\">Name<\/span><span style=\"color: #993300;\">=\"CollectionResource.xml\"<\/span> <span style=\"color: #0000ff;\">\/&gt;<\/span>\n<span style=\"color: #0000ff;\">    &lt;\/DirectorySearchRef&gt;<\/span>\n<span style=\"color: #0000ff;\"> &lt;\/Property&gt;<\/span><\/pre>\n<p>You may have noticed that we used directorysearch only once for xmlstorage search. All other occurrences are replaced with directorysearchref tags having the same id. This is to reuse the search already done instead of processing it several times for nothing. We use the same behavior when searching for files within folders.<\/p>\n<p>Now, go ahead to the directory tree definition and add references to these folders<\/p>\n<pre><span style=\"color: #0000ff;\">&lt;Directory<\/span> <span style=\"color: #ff0000;\">Id<\/span>=\"XMLSTORAGE\" <span style=\"color: #ff0000;\">Name<\/span>=\"XMLSTORAGE\"<span style=\"color: #0000ff;\">&gt;<\/span>\n<span style=\"color: #0000ff;\">   &lt;Directory<\/span> <span style=\"color: #ff0000;\">Id<\/span>=\"EXTENSIONS\" <span style=\"color: #ff0000;\">Name<\/span>=\"Extensions\"<span style=\"color: #0000ff;\">&gt;\n<\/span>\u2026\u2026\n\u2026\u2026\n<span style=\"color: #0000ff;\">      &lt;Directory<\/span> <span style=\"color: #ff0000;\">Id<\/span>=\"FORMS\" <span style=\"color: #ff0000;\">Name<\/span>=\"Forms\"<span style=\"color: #0000ff;\">\/&gt;<\/span>\n<span style=\"color: #0000ff;\">   &lt;\/Directory&gt;<\/span>\n<span style=\"color: #0000ff;\">   &lt;Directory<\/span> <span style=\"color: #ff0000;\">Id<\/span>=\"FORMSORIG\" <span style=\"color: #ff0000;\">Name<\/span>=\"Forms\"<span style=\"color: #0000ff;\">\/&gt;<\/span>\n<span style=\"color: #0000ff;\">&lt;\/Directory&gt;<\/span><\/pre>\n<hr>\n<p>As explained earlier, we need to rely on the Wix utils toolbox. So, in the project references add a new reference to the \u201cWixUtilExtension.dll\u201d file usually located in the \u201cbin\u201d subfolder of Wix installation path, then add the declaration of the specific namespace in the \u201cwix\u201d tag at beginning of the WXS file.<\/p>\n<p>Like this:<\/p>\n<pre>&lt;Wix xmlns=\"http:\/\/schemas.microsoft.com\/wix\/2006\/wi\" <span style=\"color: #339966;\"><strong>xmlns:util=\"http:\/\/schemas.microsoft.com\/wix\/UtilExtension\" <\/strong><\/span>xmlns:SystemTools=\"http:\/\/schemas.....<\/pre>\n<p>Wix Utils are ready to be used!<\/p>\n<p>Add your page project in the \u201csetup\u201d project references to make built files available.<\/p>\n<p>In the components section, we can now add a new component that will set the XML form file.<\/p>\n<pre><span style=\"color: #0000ff;\">&lt;ComponentGroup<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"devicecollmembershipcomp\"<\/strong> <span style=\"color: #ff0000;\">Directory<\/span><strong>=\"INSTALLDIR\"<\/strong><span style=\"color: #0000ff;\">&gt;<\/span>\n  <span style=\"color: #0000ff;\"> &lt;Component<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"devicecollmembershipdllcomp\"<\/strong><span style=\"color: #0000ff;\">&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;File<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"devicecollmembershipdll\"<\/strong> <span style=\"color: #ff0000;\">Source<\/span><strong>=\"$(var.deviceCollMembershipProp.TargetPath)\"<\/strong> <span style=\"color: #ff0000;\">DiskId<\/span><strong>=\"1\"<\/strong> <span style=\"color: #ff0000;\">KeyPath<\/span><strong>=\"yes\"<\/strong><span style=\"color: #0000ff;\"> \/&gt;<\/span>\n   <span style=\"color: #0000ff;\">&lt;\/Component&gt;<\/span>\n<span style=\"color: #0000ff;\">   &lt;Component<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"formCollRessXml\"<\/strong> <span style=\"color: #ff0000;\">Guid<\/span><strong>=\"GUID_AA\"<\/strong> <span style=\"color: #ff0000;\">KeyPath<\/span><strong>=\"yes\"<\/strong><span style=\"color: #0000ff;\">&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;CopyFile<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"formcolressxmlcpy\"<\/strong> <span style=\"color: #ff0000;\">SourceProperty<\/span><strong>=\"FRMCOLLRESSORIG\"<\/strong> <span style=\"color: #ff0000;\">DestinationProperty<\/span><strong>=\"EXTFORMFLD\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;Condition&gt;<\/span><strong>NOT Installed AND NOT PATCH AND NOT FRMCOLLRESS<\/strong><span style=\"color: #0000ff;\">&lt;\/Condition&gt;<\/span>\n   <span style=\"color: #0000ff;\">&lt;\/Component&gt;<\/span>\n   <span style=\"color: #0000ff;\">&lt;Component<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"colressformregistration\"<\/strong> <span style=\"color: #ff0000;\">Guid<\/span><strong>=\"GUID_BB\"<\/strong> <span style=\"color: #ff0000;\">KeyPath<\/span><strong>=\"yes\"<\/strong><span style=\"color: #0000ff;\">&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>='mypage1delinst'<\/strong> <span style=\"color: #ff0000;\">On<\/span><strong>=\"install\"<\/strong> <span style=\"color: #ff0000;\">Action<\/span><strong>=\"delete\"<\/strong> <span style=\"color: #ff0000;\">Node<\/span><strong>=\"element\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong> <span style=\"color: #ff0000;\">ElementPath<\/span><strong>=\"\/SmsFormData\/Form\/Pages\"<\/strong> <span style=\"color: #ff0000;\">VerifyPath<\/span><strong>=\"\/SmsFormData\/Form\/Pages\/Page[\\[]@Id='{GUID-TARGET}'[\\]]\"<\/strong> <span style=\"color: #ff0000;\">Sequence<\/span><strong>=\"1001\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>='mypage1'<\/strong> <span style=\"color: #ff0000;\">On<\/span><strong>=\"install\"<\/strong> <span style=\"color: #ff0000;\">Action<\/span><strong>=\"create\"<\/strong> <span style=\"color: #ff0000;\">Node<\/span><strong>=\"element\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong> <span style=\"color: #ff0000;\">ElementPath<\/span><strong>=\"\/\/SmsFormData\/\/Form\/\/Pages\"<\/strong> <span style=\"color: #ff0000;\">Sequence<\/span><strong>=\"1002\"<\/strong> <span style=\"color: #ff0000;\">Name<\/span><strong>=\"Page\"<\/strong><span style=\"color: #0000ff;\">&gt;<\/span>\n         <span style=\"color: #0000ff;\">&lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"mypage1xmlns\"<\/strong> <span style=\"color: #ff0000;\">ElementId<\/span><strong>=\"mypage1\"<\/strong> <span style=\"color: #ff0000;\">Name<\/span><strong>=\"xmlns\"<\/strong> <span style=\"color: #ff0000;\">Value<\/span><strong>=\"http:\/\/schemas.microsoft.com\/SystemsManagementServer\/2005\/03\/ConsoleFramework\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n         <span style=\"color: #0000ff;\">&lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"mypage1vendor\"<\/strong> <span style=\"color: #ff0000;\">ElementId<\/span><strong>=\"mypage1\"<\/strong> <span style=\"color: #ff0000;\">Name<\/span><strong>=\"VendorId\"<\/strong> <span style=\"color: #ff0000;\">Value<\/span><strong>=\"me\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n         <span style=\"color: #0000ff;\">&lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"mypage1id\"<\/strong> <span style=\"color: #ff0000;\">ElementId<\/span><strong>=\"mypage1\"<\/strong> <span style=\"color: #ff0000;\">Name<\/span><strong>=\"Id\"<\/strong> <span style=\"color: #ff0000;\">Value<\/span><strong>=\"{GUID-TARGET}\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n         <span style=\"color: #0000ff;\">&lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"mypage1Assembly\"<\/strong> <span style=\"color: #ff0000;\">ElementId<\/span><strong>=\"mypage1\"<\/strong> <span style=\"color: #ff0000;\">Name<\/span><strong>=\"Assembly\"<\/strong> <span style=\"color: #ff0000;\">Value<\/span><strong>=\"$(var.dcmptargetDir)$(var.deviceCollMembershipProp.TargetFileName)\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n         <span style=\"color: #0000ff;\">&lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"mypage1Namespace\"<\/strong> <span style=\"color: #ff0000;\">ElementId<\/span><strong>=\"mypage1\"<\/strong> <span style=\"color: #ff0000;\">Name<\/span><strong>=\"Namespace\"<\/strong> <span style=\"color: #ff0000;\">Value<\/span><strong>=\"Microsoft.ConfigurationManagement.AdminConsole.DeviceCollMembership\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n         <span style=\"color: #0000ff;\">&lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"mypage1Type\" <\/strong><span style=\"color: #ff0000;\">ElementId<\/span><strong>=\"mypage1\"<\/strong> <span style=\"color: #ff0000;\">Name<\/span><strong>=\"Type\"<\/strong> <span style=\"color: #ff0000;\">Value<\/span><strong>=\"DeviceCollMembershipPage\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n        <span style=\"color: #0000ff;\"> &lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"mypage1ReadOnly\"<\/strong> <span style=\"color: #ff0000;\">ElementId<\/span><strong>=\"mypage1\" <\/strong><span style=\"color: #ff0000;\">Name<\/span><strong>=\"ReadOnly\"<\/strong> <span style=\"color: #ff0000;\">Value<\/span><strong>=\"false\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n         <span style=\"color: #0000ff;\">&lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"mypage1MultiSelection\"<\/strong> <span style=\"color: #ff0000;\">ElementId<\/span><strong>=\"mypage1\"<\/strong> <span style=\"color: #ff0000;\">Name<\/span><strong>=\"MultiSelection\"<\/strong> <span style=\"color: #ff0000;\">Value<\/span><strong>=\"false\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n         <span style=\"color: #0000ff;\">&lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"mypage1Visible\"<\/strong> <span style=\"color: #ff0000;\">ElementId<\/span><strong>=\"mypage1\"<\/strong> <span style=\"color: #ff0000;\">Name<\/span><strong>=\"Visible\"<\/strong> <span style=\"color: #ff0000;\">Value<\/span><strong>=\"false\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;\/util:XmlConfig&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;util:XmlConfig<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>='mypage1del'<\/strong> <span style=\"color: #ff0000;\">On<\/span><strong>=\"uninstall\"<\/strong> <span style=\"color: #ff0000;\">Action<\/span><strong>=\"delete\"<\/strong> <span style=\"color: #ff0000;\">Node<\/span><strong>=\"element\"<\/strong> <span style=\"color: #ff0000;\">File<\/span><strong>=\"[EXTFORMFLD]CollectionResource.xml\"<\/strong> <span style=\"color: #ff0000;\">ElementPath<\/span><strong>=\"\/SmsFormData\/Form\/Pages\" <\/strong><span style=\"color: #ff0000;\">VerifyPath<\/span><strong>=\"\/SmsFormData\/Form\/Pages\/Page[\\[]@Id='{GUID-TARGET}'[\\]]\"<\/strong> <span style=\"color: #ff0000;\">Sequence<\/span><strong>=\"1003\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n   <span style=\"color: #0000ff;\">&lt;\/Component&gt;<\/span>\n<span style=\"color: #0000ff;\">&lt;\/ComponentGroup&gt;<\/span><\/pre>\n<p>Some people may find this obvious but some will not, so, here is a line by line explanation.<\/p>\n<pre><span style=\"color: #0000ff;\">&lt;Component<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"devicecollmembershipdllcomp\"<\/strong><span style=\"color: #0000ff;\">&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;File<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"devicecollmembershipdll\"<\/strong> <span style=\"color: #ff0000;\">Source<\/span><strong>=\"$(var.deviceCollMembershipProp.TargetPath)\"<\/strong> <span style=\"color: #ff0000;\">DiskId<\/span><strong>=\"1\"<\/strong> <span style=\"color: #ff0000;\">KeyPath<\/span><strong>=\"yes\"<\/strong><span style=\"color: #0000ff;\"> \/&gt;<\/span>\n   <span style=\"color: #0000ff;\">&lt;\/Component&gt;<\/span><\/pre>\n<p>nothing difficult there, we just add our brand new dll to the MSI.<\/p>\n<pre><span style=\"color: #0000ff;\">&lt;Component<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"formCollRessXml\"<\/strong> <span style=\"color: #ff0000;\">Guid<\/span><strong>=\"GUID_AA\"<\/strong> <span style=\"color: #ff0000;\">KeyPath<\/span><strong>=\"yes\"<\/strong><span style=\"color: #0000ff;\">&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;CopyFile<\/span> <span style=\"color: #ff0000;\">Id<\/span><strong>=\"formcolressxmlcpy\"<\/strong> <span style=\"color: #ff0000;\">SourceProperty<\/span><strong>=\"FRMCOLLRESSORIG\"<\/strong> <span style=\"color: #ff0000;\">DestinationProperty<\/span><strong>=\"EXTFORMFLD\"<\/strong><span style=\"color: #0000ff;\">\/&gt;<\/span>\n      <span style=\"color: #0000ff;\">&lt;Condition&gt;<\/span><strong>NOT Installed AND NOT PATCH AND NOT FRMCOLLRESS<\/strong><span style=\"color: #0000ff;\">&lt;\/Condition&gt;<\/span>\n   <span style=\"color: #0000ff;\">&lt;\/Component&gt;<\/span><\/pre>\n<p>This has to bee explained:<br \/>\nthe&nbsp;CollectionResource.xml file has to be copied from xmlstorage\\form to the xmlstorage\\extensions\\forms to be modified. this must only occur once at&nbsp;the first installation time. if the file is already present ( i.e. another 3rd party tools already use it), the target file should be overwritten. That is the purpose of the condition<br \/>\nNot Installed =&gt; almost clear: this tool should not be already present on this computer<br \/>\nNot patch =&gt; we don&#8217;t copy the file if we just update the tool<br \/>\nNot FRMCOLLRES =&gt; this is the result of our file search. this will be only positive if the target file has not been found<\/p>\n<p>If these 3 conditions are met, then we can copy the original to the extensions folder. ( don&#8217;t forget to place your own generated GUID in the dedicated property.<\/p>\n<p>The last component is nothing more than the inline edition of the XML file.<\/p>\n<p>The first element (id=mypage1delinst) can look like a bit strange as this is a deletion. I have to explain why it exists.<br \/>\n&#8220;util:XmlConfig&#8221; can be conditionnally used depending on the value of its &#8220;ON&#8221; property. the problem is that this property only allows two values: install or uninstall.<br \/>\nBut how do we manage an update? An update is also a kind of installation so the added line will be duplicated.<br \/>\nThis is why I&#8217;ve added the same deletion task on installation and uninstallation (last XmlConfig element of the component). With this workaround, I ensure that the line is removed before recreating it. ( no more duplicate )<\/p>\n<p>For people who don&#8217;t understand this, &#8216; <em>VerifyPath=&#8221;\/SmsFormData\/Form\/Pages\/Page[\\[]@Id='{GUID-TARGET}'[\\]]&#8221;<\/em> &#8216; is an XPath definition. Look around on the internet and you surely will find interting readings about this way of targeting XML elements.<\/p>\n<p>The next lines define the creation of the new xml element ( surrounding XmlConfig ) with several nested XmlConfig to define all it&#8217;s properties.<\/p>\n<p>XmlConfig Id=&#8217;mypage1&#8217; On=&#8221;install&#8221; Action=&#8221;create&#8221; Node=&#8221;element&#8221; File=&#8221;[EXTFORMFLD]CollectionResource.xml&#8221; ElementPath=&#8221;\/\/SmsFormData\/\/Form\/\/Pages&#8221; Sequence=&#8221;1002&#8243; Name=&#8221;Page&#8221;<br \/>\n<span style=\"line-height: 1.75;\">-&gt;We create a new element during installation the file specified under the SmsFormData\\Form\\Pages element.<\/span><\/p>\n<p>Here is the definition of the first properties. As they&#8217;re all constructed the same way, I will explain only this one.<\/p>\n<p>util:XmlConfig Id=&#8221;mypage1vendor&#8221; ElementId=&#8221;mypage1&#8243; Name=&#8221;VendorId&#8221; Value=&#8221;me&#8221; File=&#8221;[EXTFORMFLD]CollectionResource.xml&#8221;<\/p>\n<p>ElementId=&#8221;mypage1&#8243; =&gt; even if this element is surrounded by the Xmlconfig element that creates the XML object, we must declare a reference to it ( I don&#8217;t understand why but this is mandatory. other users over internet complain about this behavior)<\/p>\n<p>Name=&#8221;VendorId&#8221; =&gt; easy ! this is the name of the new property<br \/>\nValue=&#8221;me&#8221; =&gt; and then it&#8217;s value ^^<\/p>\n<p>File=&#8221;[EXTFORMFLD]CollectionResource.xml&#8221; =&gt; there again something I don&#8217;t understand. Why do we need to redefine the target file when we already have a reference to an existing Xml object in a specific file.<\/p>\n<p>Attention: You may have noticed that the first element redefine the xmlns property. Skilled people may wonder why I did that instead of relying on the default namespace. Answer: This extension will redefine it anyway. if you don&#8217;t redefine it, you will end with an <em>xmlns=&#8221;&#8221;&nbsp;<\/em>entry making your new element &#8216;invisible&#8217; for the SCCM console.<\/p>\n<p>That&#8217;s all!<\/p>\n<p>The last XmlConfig item should be quite easy to understand now that you already read all this!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Place our propertyPage into our MSI In part 3, we created an MSI, you thought it was complex? This was just the beginning! As explained before, the complexity resides here in finding the base file location and its modification. Moreover, we will have to handle the cleanup of this file in case of removal. To &hellip; <a href=\"https:\/\/brunocm.azurewebsites.net\/?page_id=25\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Part 7 &#8211; Add our property page to MSI&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":""},"_links":{"self":[{"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/pages\/25"}],"collection":[{"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=25"}],"version-history":[{"count":0,"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=\/wp\/v2\/pages\/25\/revisions"}],"wp:attachment":[{"href":"https:\/\/brunocm.azurewebsites.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}