SOLVED

Invalid Package - Sharepoint Framework Extensions

%3CLINGO-SUB%20id%3D%22lingo-sub-75585%22%20slang%3D%22en-US%22%3EInvalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-75585%22%20slang%3D%22en-US%22%3E%3CP%3EI%20noticed%20today%20it%20was%20released%20the%20documentation%20about%20Sharepoint%20Framework%20Extensions%20and%20I%20wanted%20to%20give%20it%20a%20try.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20followed%20the%20steps%20on%20the%20tutorials%2C%20with%20the%20only%20difference%20that%20instead%20of%20doing%20a%20console.log%20or%20alert%2C%20I%20want%20to%20inject%20App%20Insights%20Code.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20The%20code%20compiles%20fine%2C%20gulp%20serve%20works%20fine.%3C%2FP%3E%3CP%3E2.%20I%20can%20debug%20it%20as%20shown%20in%20the%20tutorials%2C%20without%20any%20problem%2C%20I%20can%20see%20the%20console%20with%20the%20messages%20I%20created%20on%20the%20TS%20file.%3C%2FP%3E%3CP%3E3.%20I%20changed%20the%20CDN%20path%20to%20Documents%20folder%2C%20yeah%20I%20know%20not%20a%20CDN%2C%20but%26nbsp%3BI%20dont%20think%20this%20has%20something%20to%20do%2C%20(Oh%20yes%20I%20uploaded%20the%20js%20files%20to%20the%20documents%20library)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20going%20to%20need%20to%20paste%20some%20large%20code%20here%20for%20you%20to%20get%20the%20idea%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Epackage-solution.json%3C%2FP%3E%3CDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CPRE%3E%7B%0A%22solution%22%3A%20%7B%0A%22name%22%3A%20%22app-insights-demo-sp-fx-extension-client-side-solution%22%2C%0A%22id%22%3A%20%2202d35a3e-5896-4664-874f-9fe9fdfe8408%22%2C%0A%22version%22%3A%20%221.0.0.0%22%2C%0A%22features%22%3A%20%5B%7B%0A%22title%22%3A%20%22Application%20Extension%20-%20Deployment%20of%20custom%20action.%22%2C%0A%22description%22%3A%20%22Deploys%20a%20custom%20action%20with%20ClientSideComponentId%20association%22%2C%0A%22id%22%3A%20%22456da147-ced2-3036-b564-8dad5c1c2e34%22%2C%0A%22version%22%3A%20%221.0.0.0%22%2C%0A%22assets%22%3A%20%7B%0A%22elementManifests%22%3A%20%5B%0A%22elements.xml%22%0A%5D%0A%7D%0A%7D%5D%0A%7D%2C%0A%22paths%22%3A%20%7B%0A%22zippedPackage%22%3A%20%22solution%2Fapp-insights-demo-sp-fx-extension.sppkg%22%0A%7D%0A%7D%3C%2FPRE%3E%3C%2FDIV%3E%3CDIV%3EElements.xml%20on%20the%20assets%20folder%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CPRE%3E%26lt%3B%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%26gt%3B%0A%26lt%3BElements%20xmlns%3D%22http%3A%2F%2Fschemas.microsoft.com%2Fsharepoint%2F%22%26gt%3B%0A%26lt%3BCustomAction%0ATitle%3D%22SPFxApplicationCustomizer%22%0ALocation%3D%22ClientSideExtension.ApplicationCustomizer%22%0AClientSideComponentId%3D%2243833b44-df29-40bf-aec2-294dd435ee05%22%26gt%3B%0A%26lt%3B%2FCustomAction%26gt%3B%0A%26lt%3B%2FElements%3C%2FPRE%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Emanifest.json%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CPRE%3E%7B%0A%22%24schema%22%3A%20%22..%2F..%2Fnode_modules%2F%40microsoft%2Fsp-module-interfaces%2Flib%2FmanifestSchemas%2FjsonSchemas%2FclientSideComponentManifestSchema.json%22%2C%0A%0A%22id%22%3A%20%2243833b44-df29-40bf-aec2-294dd435ee05%22%2C%0A%22alias%22%3A%20%22AppInsightsDemoSpFxExtensionApplication%22%2C%0A%22componentType%22%3A%20%22Extension%22%2C%0A%22extensionType%22%3A%20%22ApplicationCustomizer%22%2C%0A%22version%22%3A%20%22*%22%2C%20%2F%2F%20The%20%22*%22%20signifies%20that%20the%20version%20should%20be%20taken%20from%20the%20package.json%0A%22manifestVersion%22%3A%202%2C%0A%22safeWithCustomScriptDisabled%22%3A%20true%0A%7D%3C%2FPRE%3E%3C%2FDIV%3E%3CDIV%3Eand%20finally%20my%20extension%20code%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CPRE%3Eimport%20%7B%20override%20%7D%20from%20'%40microsoft%2Fdecorators'%3B%0Aimport%20%7B%20Log%20%7D%20from%20'%40microsoft%2Fsp-core-library'%3B%0Aimport%20%7B%0ABaseApplicationCustomizer%2C%20Placeholder%0A%7D%20from%20'%40microsoft%2Fsp-application-base'%3B%0Aimport%20%7B%20escape%20%7D%20from%20'%40microsoft%2Fsp-lodash-subset'%3B%0A%0Aimport%20*%20as%20strings%20from%20'appInsightsDemoSpFxExtensionStrings'%3B%0A%0Aconst%20LOG_SOURCE%3A%20string%20%3D%20'AppInsightsDemoSpFxExtensionApplicationCustomizer'%3B%0A%0A%2F**%0A*%20If%20your%20command%20set%20uses%20the%20ClientSideComponentProperties%20JSON%20input%2C%0A*%20it%20will%20be%20deserialized%20into%20the%20BaseExtension.properties%20object.%0A*%20You%20can%20define%20an%20interface%20to%20describe%20it.%0A*%2F%0Aexport%20interface%20IAppInsightsDemoSpFxExtensionApplicationCustomizerProperties%20%7B%0AHeader%3A%20string%3B%0A%7D%0A%0A%2F**%20A%20Custom%20Action%20which%20can%20be%20run%20during%20execution%20of%20a%20Client%20Side%20Application%20*%2F%0Aexport%20default%20class%20AppInsightsDemoSpFxExtensionApplicationCustomizer%0Aextends%20BaseApplicationCustomizer%26lt%3BIAppInsightsDemoSpFxExtensionApplicationCustomizerProperties%26gt%3B%20%7B%0A%0A%2F%2F%20Header%20reference%0Aprivate%20_headerPlaceholder%3A%20Placeholder%3B%0A%0A%40override%0Apublic%20onInit()%3A%20Promise%26lt%3Bvoid%26gt%3B%20%7B%0ALog.info(LOG_SOURCE%2C%20%60Initialized%20%24%7Bstrings.Title%7D%60)%3B%0Areturn%20Promise.resolve%26lt%3Bvoid%26gt%3B()%3B%0A%7D%0A%0A%40override%0Apublic%20onRender()%3A%20void%20%7B%0Alet%20html%3A%20string%20%3D%20''%3B%0Ahtml%2B%3D%20%60%26lt%3Bscript%20type%3D%22text%2Fjavascript%22%26gt%3B%0A%22var%20appInsights%3Dwindow.appInsights%7C%7Cfunction(config)%7B%0Afunction%20i(config)%7Bt%5Bconfig%5D%3Dfunction()%7Bvar%20i%3Darguments%3Bt.queue.push(function()%7Bt%5Bconfig%5D.apply(t%2Ci)%7D)%7D%7Dvar%20t%3D%7Bconfig%3Aconfig%7D%2Cu%3Ddocument%2Ce%3Dwindow%2Co%3D%22script%22%2Cs%3D%22AuthenticatedUserContext%22%2Ch%3D%22start%22%2Cc%3D%22stop%22%2Cl%3D%22Track%22%2Ca%3Dl%2B%22Event%22%2Cv%3Dl%2B%22Page%22%2Cy%3Du.createElement(o)%2Cr%2Cf%3By.src%3Dconfig.url%7C%7C%22https%3A%2F%2Faz416426.vo.msecnd.net%2Fscripts%2Fa%2Fai.0.js%22%3Bu.getElementsByTagName(o)%5B0%5D.parentNode.appendChild(y)%3Btry%7Bt.cookie%3Du.cookie%7Dcatch(p)%7B%7Dfor(t.queue%3D%5B%5D%2Ct.version%3D%221.0%22%2Cr%3D%5B%22Event%22%2C%22Exception%22%2C%22Metric%22%2C%22PageView%22%2C%22Trace%22%2C%22Dependency%22%5D%3Br.length%3B)i(%22track%22%2Br.pop())%3Breturn%20i(%22set%22%2Bs)%2Ci(%22clear%22%2Bs)%2Ci(h%2Ba)%2Ci(c%2Ba)%2Ci(h%2Bv)%2Ci(c%2Bv)%2Ci(%22flush%22)%2Cconfig.disableExceptionTracking%7C%7C(r%3D%22onerror%22%2Ci(%22_%22%2Br)%2Cf%3De%5Br%5D%2Ce%5Br%5D%3Dfunction(config%2Ci%2Cu%2Ce%2Co)%7Bvar%20s%3Df%26amp%3B%26amp%3Bf(config%2Ci%2Cu%2Ce%2Co)%3Breturn%20s!%3D%3D!0%26amp%3B%26amp%3Bt%5B%22_%22%2Br%5D(config%2Ci%2Cu%2Ce%2Co)%2Cs%7D)%2Ct%0A%7D(%7B%0AinstrumentationKey%3A%22b4cf6d1c-5d38-48ce-ac4e-8a7802f2a1a0%22%0A%7D)%0A%26nbsp%3B%0Awindow.appInsights%3DappInsights%3B%0AappInsights.trackPageView()%3B%0A%26lt%3B%2Fscript%26gt%3B%60%3B%0A%0Aconsole.log('CustomHeader.onRender()')%3B%0A%0A%2F%2F%20Handling%20header%20place%20holder%0Aif%20(!this._headerPlaceholder)%20%7B%0Athis._headerPlaceholder%20%3D%20this.context.placeholders.tryAttach(%0A'PageHeader'%2C%0A%7B%0AonDispose%3A%20this._onDispose%0A%7D)%3B%0A%0A%2F%2F%20The%20extension%20should%20not%20assume%20that%20the%20expected%20placeholder%20is%20available.%0Aif%20(!this._headerPlaceholder)%20%7B%0Aconsole.error('The%20expected%20placeholder%20was%20not%20found.')%3B%0Areturn%3B%0A%7D%0A%0Aif%20(this.properties)%20%7B%0Alet%20headerString%3A%20string%20%3D%20this.properties.Header%3B%0Aif%20(!headerString)%20%7B%0AheaderString%20%3D%20'(Header%20property%20was%20not%20defined.)'%3B%0A%7D%0A%0Aif%20(this._headerPlaceholder.domElement)%20%7B%0Athis._headerPlaceholder.domElement.innerHTML%20%3D%20html%3B%0Aconsole.log('injected')%3B%0A%2F%2Falert('hello%20world')%3B%0A%7D%0A%7D%0A%7D%0A%7D%0A%0Aprivate%20_onDispose()%3A%20void%20%7B%0Aconsole.log('%5BCustomHeader._onDispose%5D%20Disposed%20custom%20header.')%3B%0A%7D%0A%7D%3C%2FPRE%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20when%20I%20upload%20the%20package%20I%20get%20in%20the%20App%20Catalog%2C%20the%20column%20Valid%20App%20Package%20%3D%20NO.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20859px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F15457i8C56EC2D921B714E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%221.png%22%20title%3D%221.png%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F15456i61318C4042DCCAE9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%222.png%22%20title%3D%222.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20case%20you%20have%20some%20time%20to%20help%20me%2C%20please%20find%20the%20attached%20.RAR%2C%20I%20guess%20the%20error%20is%20going%20to%20be%20something%20very%20simple.%20%26nbsp%3Band%20yes%2C%20I%20am%20working%20on%20a%20developer%20tenant.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-75585%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-76143%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-76143%22%20slang%3D%22en-US%22%3EHi%20Luis%2C%3CBR%20%2F%3EWe%20have%20header%20and%20footer%20placeholders%20to%20start%20with.%20I%2C%20unfortunately%2C%20haven't%20had%20time%20to%20test%20app%20insights%20scenario%20yet%2C%20so%20not%20sure%20how%20it%20should%20be%20setup.%20Would%20though%20suggest%20that%20we%20get%20this%20discussion%20moved%20under%20a%20different%20topic%20in%20this%20developer%20space%20so%20that%20the%20title%20is%20accurate%20enough%20for%20other%20people%20looking%20to%20solve%20similar%20things.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-76061%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-76061%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F369%22%20target%3D%22_blank%22%3E%40Vesa%20Juvonen%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Equick%20question.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20are%20the%20available%20placeholders%3F%20by%20debugging%20I%20could%20see%20that%20is%20PageHeader%2C%20PageFooter%2C%20and%20DialogContainer%20in%20other%20pages.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20I%20am%20trying%20to%20achieve%20is%20to%20INJECT%20App%20Insights%20tracking%20code%20into%20the%20page.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20dont%20have%20any%20error%2C%20but%20according%20to%20App%20Insights%20documentation%2C%20I%20should%20put%20the%20code%20before%20the%20%20element.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20different%20ways%2C%20but%20I%20just%20can%20get%20any%20kind%20of%20stats%20on%20Applicaiton%20Insights%2C%20my%20best%20guess%20its%20becase%20the%20code%20is%20not%20before%20the%20end%20head%20tag%2C%20and%20therefore%20if%20the%20placeholder%20does%20not%20exist%2C%20then%20it%20will%20never%20work.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%20%40override%0A%20%20public%20onRender()%3A%20void%20%7B%0A%20%20%20%20let%20html%3A%20string%20%3D%20''%3B%0A%20%20%20%20html%2B%3D%20%60%26lt%3Bscript%20type%3D%22text%2Fjavascript%22%26gt%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22var%20appInsights%3Dwindow.appInsights%7C%7Cfunction(config)%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20function%20i(config)%7Bt%5Bconfig%5D%3Dfunction()%7Bvar%20i%3Darguments%3Bt.queue.push(function()%7Bt%5Bconfig%5D.apply(t%2Ci)%7D)%7D%7Dvar%20t%3D%7Bconfig%3Aconfig%7D%2Cu%3Ddocument%2Ce%3Dwindow%2Co%3D%22script%22%2Cs%3D%22AuthenticatedUserContext%22%2Ch%3D%22start%22%2Cc%3D%22stop%22%2Cl%3D%22Track%22%2Ca%3Dl%2B%22Event%22%2Cv%3Dl%2B%22Page%22%2Cy%3Du.createElement(o)%2Cr%2Cf%3By.src%3Dconfig.url%7C%7C%22https%3A%2F%2Faz416426.vo.msecnd.net%2Fscripts%2Fa%2Fai.0.js%22%3Bu.getElementsByTagName(o)%5B0%5D.parentNode.appendChild(y)%3Btry%7Bt.cookie%3Du.cookie%7Dcatch(p)%7B%7Dfor(t.queue%3D%5B%5D%2Ct.version%3D%221.0%22%2Cr%3D%5B%22Event%22%2C%22Exception%22%2C%22Metric%22%2C%22PageView%22%2C%22Trace%22%2C%22Dependency%22%5D%3Br.length%3B)i(%22track%22%2Br.pop())%3Breturn%20i(%22set%22%2Bs)%2Ci(%22clear%22%2Bs)%2Ci(h%2Ba)%2Ci(c%2Ba)%2Ci(h%2Bv)%2Ci(c%2Bv)%2Ci(%22flush%22)%2Cconfig.disableExceptionTracking%7C%7C(r%3D%22onerror%22%2Ci(%22_%22%2Br)%2Cf%3De%5Br%5D%2Ce%5Br%5D%3Dfunction(config%2Ci%2Cu%2Ce%2Co)%7Bvar%20s%3Df%26amp%3B%26amp%3Bf(config%2Ci%2Cu%2Ce%2Co)%3Breturn%20s!%3D%3D!0%26amp%3B%26amp%3Bt%5B%22_%22%2Br%5D(config%2Ci%2Cu%2Ce%2Co)%2Cs%7D)%2Ct%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D(%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20instrumentationKey%3A%22b4cf6d1c-5d38-48ce-ac4e-8a7802f2a1a0%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20enableDebug%3A%20true%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D)%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20window.appInsights%3DappInsights%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20appInsights.trackPageView()%3B%0A%20%20%20%20%20%20%20%20%20%20%26lt%3B%2Fscript%26gt%3B%60%3B%0A%0A%20%20%20%20console.log('CustomHeader.onRender()')%3B%0A%20console.log('Available%20placeholders%3A%20'%2C%0A%20%20%20%20%20%20this.context.placeholders.placeholderNames.join('%2C%20'))%3B%0A%20%20%20%20%2F%2F%20Handling%20header%20place%20holder%0A%20%20%20%20if%20(!this._headerPlaceholder)%20%7B%0A%20%20%20%20%20%20%20%20this._headerPlaceholder%20%3D%20this.context.placeholders.tryAttach(%0A%20%20%20%20%20%20%20%20%20%20'PageHeader'%2C%0A%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20onDispose%3A%20this._onDispose%0A%20%20%20%20%20%20%20%20%7D)%3B%0A%0A%20%20%20%20%20%20%2F%2F%20The%20extension%20should%20not%20assume%20that%20the%20expected%20placeholder%20is%20available.%0A%20%20%20%20%20%20if%20(!this._headerPlaceholder)%20%7B%0A%20%20%20%20%20%20%20%20console.error('The%20expected%20placeholder%20was%20not%20found.')%3B%0A%20%20%20%20%20%20%20%20return%3B%0A%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20if%20(this.properties)%20%7B%0A%20%20%20%20%20%20%20%20let%20headerString%3A%20string%20%3D%20this.properties.Header%3B%0A%20%20%20%20%20%20%20%20if%20(!headerString)%20%7B%0A%20%20%20%20%20%20%20%20%20%20headerString%20%3D%20'(Header%20property%20was%20not%20defined.)'%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20if%20(this._headerPlaceholder.domElement)%20%7B%0A%20%20%20%20%20%20%20%20%20%20this._headerPlaceholder.domElement.innerHTML%20%3D%20%60%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26lt%3Bdiv%20class%3D%22%24%7Bstyles.app%7D%22%26gt%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26lt%3Bdiv%20class%3D%22ms-bgColor-themeDark%20ms-fontColor-white%20%24%7Bstyles.header%7D%22%26gt%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26lt%3Bi%20class%3D%22ms-Icon%20ms-Icon--Info%22%20aria-hidden%3D%22true%22%26gt%3B%26lt%3B%2Fi%26gt%3B%20%24%7Bescape(headerString)%7D%26lt%3Bp%26gt%3Bhello%20world%26lt%3B%2Fp%26gt%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26lt%3Bscript%20type%3D%22text%2Fjavascript%22%26gt%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22var%20appInsights%3Dwindow.appInsights%7C%7Cfunction(config)%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20function%20i(config)%7Bt%5Bconfig%5D%3Dfunction()%7Bvar%20i%3Darguments%3Bt.queue.push(function()%7Bt%5Bconfig%5D.apply(t%2Ci)%7D)%7D%7Dvar%20t%3D%7Bconfig%3Aconfig%7D%2Cu%3Ddocument%2Ce%3Dwindow%2Co%3D%22script%22%2Cs%3D%22AuthenticatedUserContext%22%2Ch%3D%22start%22%2Cc%3D%22stop%22%2Cl%3D%22Track%22%2Ca%3Dl%2B%22Event%22%2Cv%3Dl%2B%22Page%22%2Cy%3Du.createElement(o)%2Cr%2Cf%3By.src%3Dconfig.url%7C%7C%22https%3A%2F%2Faz416426.vo.msecnd.net%2Fscripts%2Fa%2Fai.0.js%22%3Bu.getElementsByTagName(o)%5B0%5D.parentNode.appendChild(y)%3Btry%7Bt.cookie%3Du.cookie%7Dcatch(p)%7B%7Dfor(t.queue%3D%5B%5D%2Ct.version%3D%221.0%22%2Cr%3D%5B%22Event%22%2C%22Exception%22%2C%22Metric%22%2C%22PageView%22%2C%22Trace%22%2C%22Dependency%22%5D%3Br.length%3B)i(%22track%22%2Br.pop())%3Breturn%20i(%22set%22%2Bs)%2Ci(%22clear%22%2Bs)%2Ci(h%2Ba)%2Ci(c%2Ba)%2Ci(h%2Bv)%2Ci(c%2Bv)%2Ci(%22flush%22)%2Cconfig.disableExceptionTracking%7C%7C(r%3D%22onerror%22%2Ci(%22_%22%2Br)%2Cf%3De%5Br%5D%2Ce%5Br%5D%3Dfunction(config%2Ci%2Cu%2Ce%2Co)%7Bvar%20s%3Df%26amp%3B%26amp%3Bf(config%2Ci%2Cu%2Ce%2Co)%3Breturn%20s!%3D%3D!0%26amp%3B%26amp%3Bt%5B%22_%22%2Br%5D(config%2Ci%2Cu%2Ce%2Co)%2Cs%7D)%2Ct%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D(%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20instrumentationKey%3A%22b4cf6d1c-5d38-48ce-ac4e-8a7802f2a1a0%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20enableDebug%3A%20true%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D)%0A%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20window.appInsights%3DappInsights%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20appInsights.trackPageView()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26lt%3B%2Fscript%26gt%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26lt%3B%2Fdiv%26gt%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%26lt%3B%2Fdiv%26gt%3B%60%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%2F%2Fthis._headerPlaceholder.domElement.innerHTML%20%3D%20html%3B%0A%20%20%20%20%20%20%20%20%20%20console.log('injected')%3B%0A%20%20%20%20%20%20%20%20%20%20%2F%2Falert('hello%20world')%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-76046%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-76046%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Pat.%26nbsp%3B%20That's%20working%20again%20now.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-76044%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-76044%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20pointing%20that%20out%20Pete.%20%26nbsp%3BWe%20believe%20we%20have%20stopped%20the%20behaviour%2C%20and%20should%20work%20in%20a%20few%20minutes.%20%26nbsp%3BPlease%20let%20us%20know%20if%20it%20continues%20to%20be%20a%20problem.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-76040%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-76040%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20guys%2C%20I've%20just%20started%20getting%20something%20similar.%26nbsp%3B%20I%20previously%20deployed%20a%20package%20happily%20to%20both%20our%20dev%20tenant%20catalog%20and%20also%20to%20our%20test%20tenant%20catalog.%26nbsp%3B%26nbsp%3B%20After%20making%20a%20few%20updates%20in%20the%20last%2024%2F48%20hrs%20I'm%20now%20no%20longer%20able%20to%20deploy%20the%20package%20to%20the%20test%20tenant%20catalog%20(I%20can%20still%20happily%20deploy%20the%20package%20to%20our%20dev%20tenant%20catalog).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20test%20tenant%20catalog%2C%20it%20notes%20the%20following%20error%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EInvalid%20SharePoint%20App%20package.%20Error%3A%20Unable%20to%20cast%20object%20of%20type%20'Microsoft.SharePoint.%3CSTRONG%3EClientSideFramework%3C%2FSTRONG%3E.SPClientSideComponentMetadata'%20to%20type%20'Microsoft.SharePoint.%3CSTRONG%3EClientSideComponent%3C%2FSTRONG%3E.SPClientSideComponentMetadata'.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20casting%20error%20between%20ClientSideFramework%20and%20ClientSideComponent.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENote%3A%20I%20haven't%20upgraded%20my%20current%20yo%20template%20to%20the%20latest%201.1.0%20version.%26nbsp%3B%20It's%20using%20the%20GA%20release%20version%201.0.0.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20ideas%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3CBR%20%2F%3EPete%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-76007%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-76007%22%20slang%3D%22en-US%22%3E%3CP%3ESP%20User%20voice%20suggestion%20created%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsharepoint.uservoice.com%2Fforums%2F329220-sharepoint-dev-platform%2Fsuggestions%2F19527688-please-let-us-know-what-is-wrong-with-xml-files-o%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsharepoint.uservoice.com%2Fforums%2F329220-sharepoint-dev-platform%2Fsuggestions%2F19527688-please-let-us-know-what-is-wrong-with-xml-files-o%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-75988%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-75988%22%20slang%3D%22en-US%22%3EGood%20suggestion%20around%20the%20schema%20validation%20improvement.%20Thx%20Luis.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-75983%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-75983%22%20slang%3D%22en-US%22%3Ebtw%2C%20I%20guess%20gulp%20serve%20only%20compiles%2Ftranspiles%20typescript%20and%20it%20doesnt%20check%20xml%20files%20thats%20why%20the%20error%20never%20came%20up%2C%20any%20idea%20how%20to%20avoid%20this%20in%20the%20future%20(my%20question%20is%20from%20the%20tooling%20perspective)%2C%20it%20would%20be%20nice%20to%20see%20a%20warning%20somewhere.%3CBR%20%2F%3E%3CBR%20%2F%3EMaybe%20a%20gulp%20custom%20task%2C%20that%20checks%20xml%20formatting%20at%20least%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-75982%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-75982%22%20slang%3D%22en-US%22%3E%3CP%3EAmazing%2C%20thanks%20a%20lot%20Vesa%2C%20sometimes%20just%20fresh%20eyes%20will%20spot%20the%20errors%20in%20minutes..%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-75978%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-75978%22%20slang%3D%22en-US%22%3E%3CP%3EIssue%20was%20in%20the%20elements.xml%20file%2C%20but%20not%20in%20encoding.%20More%20obvious%20than%20that%2C%20but%20still%20hard%20to%20catch.%20App%20catalow%20actually%20has%20actually%20%22unavailable%20apps%22%20link%2C%20which%20provides%20details%20on%20the%20possible%20errors%20and%26nbsp%3Bit's%20typically%20really%20accurate.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F15511iB9016F61C635E225%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22apps-sharepoint.jpg%22%20title%3D%22apps-sharepoint.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20open%20up%20the%20elements.xml%20file%20from%20the%26nbsp%3Bsharepoint%2Fassets%20folder%2C%20you%20can%20see%20that%20the%20last%20Elements%20element%20is%20missing%20closing%20tag%2C%20like%20defined%20in%20above%20exception.%20Below%20is%20the%20original%20Elements.xml%20file%20content%20and%20you%20can%20see%20that%20we%20are%20missing%20final%20%26gt%3B%20closing.%20After%20adding%20that%20missing%20character%20there%2C%20it%20was%20all%20good%20for%20deployment.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%26lt%3B%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%26gt%3B%0A%26lt%3BElements%20xmlns%3D%22http%3A%2F%2Fschemas.microsoft.com%2Fsharepoint%2F%22%26gt%3B%0A%20%20%20%20%26lt%3BCustomAction%20%0A%20%20%20%20%20%20%20%20Title%3D%22SPFxApplicationCustomizer%22%0A%20%20%20%20%20%20%20%20Location%3D%22ClientSideExtension.ApplicationCustomizer%22%0A%20%20%20%20%20%20%20%20ClientSideComponentId%3D%2243833b44-df29-40bf-aec2-294dd435ee05%22%26gt%3B%0A%20%20%20%20%26lt%3B%2FCustomAction%26gt%3B%0A%26lt%3B%2FElements%3C%2FPRE%3E%0A%3CP%3ESo%20-%20completely%20logical%20reason%2C%20was%20just%20hard%20to%20spot.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-75850%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-75850%22%20slang%3D%22en-US%22%3Edidnt%20try%20it%2C%20but%20I%20will%20check%20also%20with%20Vesa%20suggestion%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-75708%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-75708%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Vesa%20for%20your%20reply%2C%20I%20will%20try%20your%20suggestion%20when%20I%20get%20home%20at%20night%2C%20in%20the%20meantime%2C%20please%20see%20the%20app%20package%20attached.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-75667%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-75667%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Luis%2C%3C%2FP%3E%0A%3CP%3Eapparently%20issue%20was%20visible%20only%20when%20you%20reference%20elements.xml%20file%20in%20the%20package.%20If%20you%20remove%20the%20reference%20from%20package-solution.json%2C%20everything%20was%20working%20fine.%20There%20was%20no%20visible%20reason%20for%20why%20it%20failed%2C%20so%20suspecting%20some%20sort%20of%20an%20encoding%20issue.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20deleted%20existing%20elements.xml%20file%20and%20recreated%20that%20with%20needed%20elements%20and%20all%20works%20fine.%20I%20can't%20really%20explain%20this%20in%20100%25%20level%2C%20but%20that%20should%20fix%20the%20issue%20with%20you%20as%20well.%20If%20you%20still%20though%20have%20the%20original%20package%20(sppkg%2C%20which%20failed)%2C%20can%20you%20zip%20that%20and%20also%20share%20it%2C%20so%20that%20we%20can%20truly%20do%20a%20repro%20for%20this%2C%20since%20want%20to%20understand%20what%20actually%20in%20detailed%20went%20wrong%2C%20so%20looping%20right%20engineers%20for%20this%20to%20avoid%20future%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-75591%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-75591%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Luis%2C%20does%20the%20package%20validate%20if%20you%20just%20run%20the%20Yeoman%20generator%20and%20package%20up%20the%20results%20of%20the%20default%20HelloWorld%20project%20without%20making%20any%20other%20changes%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-Jeremy%20Kelley%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-75589%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-75589%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Pat%2C%20thanks%20for%20the%20quick%20reply%2C%20yes%20its%20a%20developer%20tenant%2C%20I%20created%20this%20one%20when%20the%20first%20public%20preview%26nbsp%3B%26nbsp%3Bof%20SPFx%20came%20out%20last%20year%2C%20so%20I%20dont%20think%20that%20should%20be%20the%20issue%2C%20but%20if%20there%20is%20a%20way%20to%20verify%20via%20powershell%20or%20something%20in%20the%20admin%20center%2C%20let%20me%20know%20and%20I%20can%20double%20check.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20meantime%2C%20I%20also%20uploaded%20a%20.RAR%20file%20with%20all%20the%20code%2C%20in%20case%20anyone%20on%20the%20PG%20can%20take%20a%20quick%20look.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwetransfer.com%2Fdownloads%2F705a938fc611eb1352731914c1fd80b920170607043607%2F20c0cf80a35d6ff8aaa1ae3856a53d4820170607043607%2F984fc7%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwetransfer.com%2Fdownloads%2F705a938fc611eb1352731914c1fd80b920170607043607%2F20c0cf80a35d6ff8aaa1ae3856a53d4820170607043607%2F984fc7%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20again%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-75588%22%20slang%3D%22en-US%22%3ERe%3A%20Invalid%20Package%20-%20Sharepoint%20Framework%20Extensions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-75588%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Luis%20-%20what%20kind%20of%20tenant%20do%20you%20have%20-%20do%20you%20happen%20to%20know%3F%20%26nbsp%3BThe%20first%20drop%20will%20likely%20change%20a%20bunch%2C%20and%20we%20don't%20want%20people%20to%20be%20running%20it%20on%20production%20environments%2C%20so%20for%20now%20it%20requires%20a%20developer%20tenant%20(not%20a%20developer%20site%20collection%2C%20but%20a%20developer%20tenant).%20%26nbsp%3BI%20believe%20the%20online%20documentation%20describes%20how%20to%20get%20one%2C%20but%20the%20link%20is%20here%20-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdev.office.com%2Fdevprogram%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdev.office.com%2Fdevprogram%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHopefully%20that%20unblocks%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Deleted
Not applicable

I noticed today it was released the documentation about Sharepoint Framework Extensions and I wanted to give it a try.

 

I followed the steps on the tutorials, with the only difference that instead of doing a console.log or alert, I want to inject App Insights Code.

 

1. The code compiles fine, gulp serve works fine.

2. I can debug it as shown in the tutorials, without any problem, I can see the console with the messages I created on the TS file.

3. I changed the CDN path to Documents folder, yeah I know not a CDN, but I dont think this has something to do, (Oh yes I uploaded the js files to the documents library)

 

I am going to need to paste some large code here for you to get the idea:

 

package-solution.json

 
{
"solution": {
"name": "app-insights-demo-sp-fx-extension-client-side-solution",
"id": "02d35a3e-5896-4664-874f-9fe9fdfe8408",
"version": "1.0.0.0",
"features": [{
"title": "Application Extension - Deployment of custom action.",
"description": "Deploys a custom action with ClientSideComponentId association",
"id": "456da147-ced2-3036-b564-8dad5c1c2e34",
"version": "1.0.0.0",
"assets": {
"elementManifests": [
"elements.xml"
]
}
}]
},
"paths": {
"zippedPackage": "solution/app-insights-demo-sp-fx-extension.sppkg"
}
}
Elements.xml on the assets folder
 
 
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Title="SPFxApplicationCustomizer"
Location="ClientSideExtension.ApplicationCustomizer"
ClientSideComponentId="43833b44-df29-40bf-aec2-294dd435ee05">
</CustomAction>
</Elements
 
manifest.json
 
 
{
"$schema": "../../node_modules/@microsoft/sp-module-interfaces/lib/manifestSchemas/jsonSchemas/clientSideComponentManifestSchema.json",

"id": "43833b44-df29-40bf-aec2-294dd435ee05",
"alias": "AppInsightsDemoSpFxExtensionApplication",
"componentType": "Extension",
"extensionType": "ApplicationCustomizer",
"version": "*", // The "*" signifies that the version should be taken from the package.json
"manifestVersion": 2,
"safeWithCustomScriptDisabled": true
}
and finally my extension code
 
 
import { override } from '@microsoft/decorators';
import { Log } from '@microsoft/sp-core-library';
import {
BaseApplicationCustomizer, Placeholder
} from '@microsoft/sp-application-base';
import { escape } from '@microsoft/sp-lodash-subset';

import * as strings from 'appInsightsDemoSpFxExtensionStrings';

const LOG_SOURCE: string = 'AppInsightsDemoSpFxExtensionApplicationCustomizer';

/**
* If your command set uses the ClientSideComponentProperties JSON input,
* it will be deserialized into the BaseExtension.properties object.
* You can define an interface to describe it.
*/
export interface IAppInsightsDemoSpFxExtensionApplicationCustomizerProperties {
Header: string;
}

/** A Custom Action which can be run during execution of a Client Side Application */
export default class AppInsightsDemoSpFxExtensionApplicationCustomizer
extends BaseApplicationCustomizer<IAppInsightsDemoSpFxExtensionApplicationCustomizerProperties> {

// Header reference
private _headerPlaceholder: Placeholder;

@override
public onInit(): Promise<void> {
Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);
return Promise.resolve<void>();
}

@override
public onRender(): void {
let html: string = '';
html+= `<script type="text/javascript">
"var appInsights=window.appInsights||function(config){
function i(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},u=document,e=window,o="script",s="AuthenticatedUserContext",h="start",c="stop",l="Track",a=l+"Event",v=l+"Page",y=u.createElement(o),r,f;y.src=config.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js";u.getElementsByTagName(o)[0].parentNode.appendChild(y);try{t.cookie=u.cookie}catch(p){}for(t.queue=[],t.version="1.0",r=["Event","Exception","Metric","PageView","Trace","Dependency"];r.length;)i("track"+r.pop());return i("set"+s),i("clear"+s),i(h+a),i(c+a),i(h+v),i(c+v),i("flush"),config.disableExceptionTracking||(r="onerror",i("_"+r),f=e[r],e[r]=function(config,i,u,e,o){var s=f&&f(config,i,u,e,o);return s!==!0&&t["_"+r](config,i,u,e,o),s}),t
}({
instrumentationKey:"b4cf6d1c-5d38-48ce-ac4e-8a7802f2a1a0"
})
 
window.appInsights=appInsights;
appInsights.trackPageView();
</script>`;

console.log('CustomHeader.onRender()');

// Handling header place holder
if (!this._headerPlaceholder) {
this._headerPlaceholder = this.context.placeholders.tryAttach(
'PageHeader',
{
onDispose: this._onDispose
});

// The extension should not assume that the expected placeholder is available.
if (!this._headerPlaceholder) {
console.error('The expected placeholder was not found.');
return;
}

if (this.properties) {
let headerString: string = this.properties.Header;
if (!headerString) {
headerString = '(Header property was not defined.)';
}

if (this._headerPlaceholder.domElement) {
this._headerPlaceholder.domElement.innerHTML = html;
console.log('injected');
//alert('hello world');
}
}
}
}

private _onDispose(): void {
console.log('[CustomHeader._onDispose] Disposed custom header.');
}
}

 

However, when I upload the package I get in the App Catalog, the column Valid App Package = NO.

 

1.png2.png

 

 

In case you have some time to help me, please find the attached .RAR, I guess the error is going to be something very simple.  and yes, I am working on a developer tenant.

 

 

16 Replies
Highlighted

Hi Luis - what kind of tenant do you have - do you happen to know?  The first drop will likely change a bunch, and we don't want people to be running it on production environments, so for now it requires a developer tenant (not a developer site collection, but a developer tenant).  I believe the online documentation describes how to get one, but the link is here - https://dev.office.com/devprogram

 

Hopefully that unblocks you.

Highlighted

Hi Pat, thanks for the quick reply, yes its a developer tenant, I created this one when the first public preview  of SPFx came out last year, so I dont think that should be the issue, but if there is a way to verify via powershell or something in the admin center, let me know and I can double check.

 

In the meantime, I also uploaded a .RAR file with all the code, in case anyone on the PG can take a quick look.

 

https://wetransfer.com/downloads/705a938fc611eb1352731914c1fd80b920170607043607/20c0cf80a35d6ff8aaa1...

 

Thanks again

Highlighted

Hi Luis, does the package validate if you just run the Yeoman generator and package up the results of the default HelloWorld project without making any other changes?

 

Thanks!

 

-Jeremy Kelley

Highlighted

Hi Luis,

apparently issue was visible only when you reference elements.xml file in the package. If you remove the reference from package-solution.json, everything was working fine. There was no visible reason for why it failed, so suspecting some sort of an encoding issue.

 

I deleted existing elements.xml file and recreated that with needed elements and all works fine. I can't really explain this in 100% level, but that should fix the issue with you as well. If you still though have the original package (sppkg, which failed), can you zip that and also share it, so that we can truly do a repro for this, since want to understand what actually in detailed went wrong, so looping right engineers for this to avoid future issue.

Highlighted

Thanks Vesa for your reply, I will try your suggestion when I get home at night, in the meantime, please see the app package attached.

 

 

Highlighted
didnt try it, but I will check also with Vesa suggestion
Highlighted
Solution

Issue was in the elements.xml file, but not in encoding. More obvious than that, but still hard to catch. App catalow actually has actually "unavailable apps" link, which provides details on the possible errors and it's typically really accurate.

 

apps-sharepoint.jpg

 

If you open up the elements.xml file from the sharepoint/assets folder, you can see that the last Elements element is missing closing tag, like defined in above exception. Below is the original Elements.xml file content and you can see that we are missing final > closing. After adding that missing character there, it was all good for deployment.

 

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction 
        Title="SPFxApplicationCustomizer"
        Location="ClientSideExtension.ApplicationCustomizer"
        ClientSideComponentId="43833b44-df29-40bf-aec2-294dd435ee05">
    </CustomAction>
</Elements

So - completely logical reason, was just hard to spot. 

Highlighted

Amazing, thanks a lot Vesa, sometimes just fresh eyes will spot the errors in minutes..

Highlighted
btw, I guess gulp serve only compiles/transpiles typescript and it doesnt check xml files thats why the error never came up, any idea how to avoid this in the future (my question is from the tooling perspective), it would be nice to see a warning somewhere.

Maybe a gulp custom task, that checks xml formatting at least?
Highlighted
Good suggestion around the schema validation improvement. Thx Luis.
Highlighted
Highlighted

Hi guys, I've just started getting something similar.  I previously deployed a package happily to both our dev tenant catalog and also to our test tenant catalog.   After making a few updates in the last 24/48 hrs I'm now no longer able to deploy the package to the test tenant catalog (I can still happily deploy the package to our dev tenant catalog).

 

In the test tenant catalog, it notes the following error: 

 

Invalid SharePoint App package. Error: Unable to cast object of type 'Microsoft.SharePoint.ClientSideFramework.SPClientSideComponentMetadata' to type 'Microsoft.SharePoint.ClientSideComponent.SPClientSideComponentMetadata'.

 

A casting error between ClientSideFramework and ClientSideComponent.

 

Note: I haven't upgraded my current yo template to the latest 1.1.0 version.  It's using the GA release version 1.0.0.

 

Any ideas?

 

Regards
Pete

Highlighted

Thanks for pointing that out Pete.  We believe we have stopped the behaviour, and should work in a few minutes.  Please let us know if it continues to be a problem.

Highlighted

Thanks Pat.  That's working again now.

Highlighted

 

@Vesa Juvonen

 

quick question.

 

What are the available placeholders? by debugging I could see that is PageHeader, PageFooter, and DialogContainer in other pages.

 

What I am trying to achieve is to INJECT App Insights tracking code into the page.

 

I dont have any error, but according to App Insights documentation, I should put the code before the </head> element.

 

I tried different ways, but I just can get any kind of stats on Applicaiton Insights, my best guess its becase the code is not before the end head tag, and therefore if the placeholder does not exist, then it will never work.

 

 @override
  public onRender(): void {
    let html: string = '';
    html+= `<script type="text/javascript">
              "var appInsights=window.appInsights||function(config){
              function i(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},u=document,e=window,o="script",s="AuthenticatedUserContext",h="start",c="stop",l="Track",a=l+"Event",v=l+"Page",y=u.createElement(o),r,f;y.src=config.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js";u.getElementsByTagName(o)[0].parentNode.appendChild(y);try{t.cookie=u.cookie}catch(p){}for(t.queue=[],t.version="1.0",r=["Event","Exception","Metric","PageView","Trace","Dependency"];r.length;)i("track"+r.pop());return i("set"+s),i("clear"+s),i(h+a),i(c+a),i(h+v),i(c+v),i("flush"),config.disableExceptionTracking||(r="onerror",i("_"+r),f=e[r],e[r]=function(config,i,u,e,o){var s=f&&f(config,i,u,e,o);return s!==!0&&t["_"+r](config,i,u,e,o),s}),t
              }({
                  instrumentationKey:"b4cf6d1c-5d38-48ce-ac4e-8a7802f2a1a0",
                  enableDebug: true,
              })
      
              window.appInsights=appInsights;
              appInsights.trackPageView();
          </script>`;

    console.log('CustomHeader.onRender()');
 console.log('Available placeholders: ',
      this.context.placeholders.placeholderNames.join(', '));
    // Handling header place holder
    if (!this._headerPlaceholder) {
        this._headerPlaceholder = this.context.placeholders.tryAttach(
          'PageHeader',
          {
          onDispose: this._onDispose
        });

      // The extension should not assume that the expected placeholder is available.
      if (!this._headerPlaceholder) {
        console.error('The expected placeholder was not found.');
        return;
      }

      if (this.properties) {
        let headerString: string = this.properties.Header;
        if (!headerString) {
          headerString = '(Header property was not defined.)';
        }

        if (this._headerPlaceholder.domElement) {
          this._headerPlaceholder.domElement.innerHTML = `
                <div class="${styles.app}">
                  <div class="ms-bgColor-themeDark ms-fontColor-white ${styles.header}">
                    <i class="ms-Icon ms-Icon--Info" aria-hidden="true"></i> ${escape(headerString)}<p>hello world</p>
                          <script type="text/javascript">
                    "var appInsights=window.appInsights||function(config){
                    function i(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},u=document,e=window,o="script",s="AuthenticatedUserContext",h="start",c="stop",l="Track",a=l+"Event",v=l+"Page",y=u.createElement(o),r,f;y.src=config.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js";u.getElementsByTagName(o)[0].parentNode.appendChild(y);try{t.cookie=u.cookie}catch(p){}for(t.queue=[],t.version="1.0",r=["Event","Exception","Metric","PageView","Trace","Dependency"];r.length;)i("track"+r.pop());return i("set"+s),i("clear"+s),i(h+a),i(c+a),i(h+v),i(c+v),i("flush"),config.disableExceptionTracking||(r="onerror",i("_"+r),f=e[r],e[r]=function(config,i,u,e,o){var s=f&&f(config,i,u,e,o);return s!==!0&&t["_"+r](config,i,u,e,o),s}),t
                    }({
                        instrumentationKey:"b4cf6d1c-5d38-48ce-ac4e-8a7802f2a1a0",
                        enableDebug: true,
                    })
            
                    window.appInsights=appInsights;
                    appInsights.trackPageView();
                </script>
                  </div>
                </div>`;

          //this._headerPlaceholder.domElement.innerHTML = html;
          console.log('injected');
          //alert('hello world');
        }
      }
    }
  }
Highlighted
Hi Luis,
We have header and footer placeholders to start with. I, unfortunately, haven't had time to test app insights scenario yet, so not sure how it should be setup. Would though suggest that we get this discussion moved under a different topic in this developer space so that the title is accurate enough for other people looking to solve similar things.