I've had the same issue on my build server.
The package would build perfectly on my development machine but would fail with the exact same error you have on my build server. For me the problem was caused by the fact that on my build machine, the application is not registered with IIS.
The problem started when I enabled local testing in IIS Express in the project and in some indirect way that enables the IncludeIisSettings=true
setting you mentioned. This causes the web deployment pipeline to query IIS for the site's details. Since the build server did not have IIS 7 or IIS Express installed it could not get those settings. This ultimately leads to the error above because the parameter passed to the EscapeTextForRegularExpressions
task is empty.
My solution was to set IncludeIisSettings
to False
in the applications .wpp.targets file (see here for an example .wpp.targets file). If you specify the settings for IIS explicitly, that should not be a problem.
I was also able to fix the build by registering the site with IIS Express using WebMatrix. Running the site in Visual Studio should have the same effect.