Often on a new project, I want to publish to Azure directly from Visual Studio. When I'm performing a web deploy from Visual Studio, I frequently bump into a failed build due to a web.config not being able to be published. Some common plug-ins where I've encountered this issue is with Articulate, LeBlender and even some of the Umbraco install files, for reference these config files can be found in:
Fixing the issue is really simple. Open up your
By default when you do a web deploy, Visual Studio uses something called auto-parameterization to perform essential transforms and ensure the configs have been set with the correct config for the environment you want to publish to, the most common configuration will be 'release'. When auto-parameterization occurs Visual Studio looks for all the defined 'web.config' files within your project, if any are found then Visual Studio will attempt to apply environment specific transformations onto them.
If you do not have a specific release version of a config file when you perform a publish, the process can fail as Visual Studio does not know how to apply auto parameterization on it.
For reference, the web.config files that break the Visual Studio build/publish are normally the ones added in any third-party Umbraco packages, within 'App_Plugins'. To fix this issue within your [projectname].wpp.targets, either add - or if it's already there, update - the following config option:
After saving your change, it's best to close your solution down and re-open. Now when you try to publish it should go through without any complaints, enjoy!