I created a vs solution with :
- 2 Site columns
- One content type
- One list template
- One list instance.
It compiles without any problem. The feature packages all 4 things, IsHidden is set to true because its meant to be enabled via powershell only.
However when I enable it, i got the following exceptions in the log
Enable-SPFeature : Key cannot be null.
Parameter name: key
At line:28 char:17
+ Enable-SPFeature <<<< "SlnOneSkyTeamsCustomization_FeatureExternalCIRCASites" -Url http://ost-dev1.ciredev1.local/
+ CategoryInfo : InvalidData: (Microsoft.Share...etEnableFeature:SPCmdletEnableFeature) [Enable-SPFeature], ArgumentNullException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature
I install the feature like this:
# Adds and Installs the SP Solution
Add-SPSolution -LiteralPath "D:\Sources\s\27022012\SlnOneSkyTeamsCustomization\SlnOneSkyTeamsCustomization\bin\Debug\SlnOneSkyTeamsCustomization.wsp"
Install-SPSolution –Identity SlnOneSkyTeamsCustomization.wsp -GACDeployment -Force
# Install-SPFeature use it only after installing or upgrading the solution
Install-SPFeature "SlnOneSkyTeamsCustomization_FeatureExternalCIRCASites" -force
Enable-SPFeature "SlnOneSkyTeamsCustomization_FeatureExternalCIRCASites" -Url http://x/
Only the last line is the one that throws the exception.
on the uls logs I see also: Key cannot be null. Parameter name: key
Feature Activation: Threw an exception, attempting to roll back. Feature 'SlnOneSkyTeamsCustomization_FeatureExternalCIRCASites' (ID: '4abb1043-ac29-4897-8ebc-7e01b897e6ed'). Exception: System.ArgumentNullException: Key cannot be null. Parameter name: key at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionFieldsAndContentTypes(SPFeaturePropertyCollection props, SPSite site, SPWeb web, Boolean fForce) at Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, Boolean fForce) at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, Boolean fForce)
Error Category: InvalidData Target Object Microsoft.SharePoint.PowerShell.SPCmdletEnableFeature Details NULL RecommendedAction NULL
I can show the code for all files here below.