Workaround for Publishing LightSwitch App to Azure Web Sites (Error: Web deployment task failed. (Modifying application pool properties is not supported by this server environment. #ERROR_NOT_SUPPORTED))

Some customers recently came across an issue where publishing a LightSwitch application to an Azure Web Site resulted in a deployment error:

 

Error    1    Web deployment task failed. (Modifying application pool properties is not supported by this server environment.
  Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_NOT_SUPPORTED.)    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets

 

This is being caused by a recent change to Azure Web Sites infrastructure that no longer allows certain properties to be changed through Web Deploy.  LightSwitch publish attempts to change the .NET Framework version of the application pool to v4.0 and the pipeline to Integrated.  The above error occurs even if the web site’s application pool was already configured with these values (i.e. we wouldn’t actually be changing anything).  We are investigating if this particular case can be addressed through the Azure Web Sites infrastructure.  In the meantime, this issue can be worked around by doing the following:

In the Server Explorer, expand Windows Azure >> Web Sites (you may need to enter your Azure credentials at this point).  Right-click on the Azure Web Site that you are attempting to publish to and select “View Settings”

 

image

 

 

Find the “Application Settings” section at the bottom of the designer that opens and click the “Add” button

image

 

Set the “Key” to WEBSITE_WEBDEPLOY_USE_SCM and the “Value to false

image

Click on the “Save” button at the top of the designer

image

Wait for this to complete, then use the LightSwitch publish wizard and re-publish.  The app should deploy properly now.  I will update this post when I know more about when this workaround will no longer be needed.