Our ASP.NET Web Api project has two deployment configurations (.pubxml):
The Web deployment (1) works just fine. The Package deployment to a zip is failing with the following errors:
Warning 3   No element in the source document matches '/configuration/system.identityModel'     20  10  MyWebProject
Error   4   No element in the source document matches '/configuration/system.identityModel/identityConfiguration'       21  10  MyWebProject
Looking at the verbose logs, I can see it's failing during the Web.config transform.
        ParameterizeTransformXml:   No element in the source document matches '/configuration/appSettings/add[@key='ida:AudienceUri']'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 7, 9)
        ParameterizeTransformXml:   No element in the source document matches '/configuration/appSettings/add[@key='ida:Realm']'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 10, 9)
        ParameterizeTransformXml:   No element in the source document matches '/configuration/appSettings/add[@key='ida:FederationMetadataLocation']'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 13, 9)
 Warning : No element in the source document matches '/configuration/system.identityModel'
        ParameterizeTransformXml:   Not executing RemoveAll (transform line 24, 14)
 Error : No element in the source document matches '/configuration/system.identityModel/identityConfiguration'
        ParameterizeTransformXml:   Not executing Insert (transform line 27, 9)
        ParameterizeTransformXml:   No element in the source document matches '/configuration/system.identityModel'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 33, 9)
        ParameterizeTransformXml:   No element in the source document matches '/configuration/system.identityModel.services'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 42, 9)
        ParameterizeTransformXml:   No element in the source document matches '/configuration/system.identityModel.services'
        ParameterizeTransformXml:   Not executing SetTokenizedAttributes (transform line 45, 9)
        ParameterizeTransformXml: Transformation failed
        Done executing task "ParameterizeTransformXml" -- FAILED.
        Done building target "_TransformWebConfigForAzureAuthenticationCore" in project "MyWebProject.csproj" -- FAILED.
Done building project "MyWebProject.csproj" -- FAILED.
What additional build information do I need to configure to get the Zip deployment past these errors? It works just fine if I do a direct web deployment.
Check your publish settings to see if you have EnableADPublish set to true. That was my problem (I was configuring Azure AD Auth through other means), so I just set it to false and everything worked great.
<EnableADPublish>false</EnableADPublish>
Cheers, Jeff
I added the below configuration explicitly:
<system.identityModel>
    <identityConfiguration>
      <audienceUris>        
      </audienceUris>
    </identityConfiguration>
</system.identityModel>
It is able to create the package finally!
If you are using the publish wizard, make sure that "Enable Organizational Authentication" is unchecked**. This fixed it for me.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With