Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild IIS issue

I'm using MSBuild to package and publish an my Asp.Net MVC 3, .Net 4 Application. I've already successfully done this for an MVC 1.0, .Net 3.5 application.

Whenever I include the IIS Settings (IncludeIisSettings=true) in my .proj file I get the following build error:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2046, 5): error MSB4044: The "EscapeTextForRegularExpressions" task was not given a value for the required parameter "Text".

like image 903
user1445553 Avatar asked Jun 08 '12 23:06

user1445553


2 Answers

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.

like image 133
Marnix van Valen Avatar answered Oct 17 '22 09:10

Marnix van Valen


The issue I had was with permissions, specifically UAC settings in Windows 7 after switching laptops.

After close inspection against my previous configuration I realized I still had the default UAC Settings. To change go to Start > Control Panel > User Accounts > User Accounts > Change User Account Control Settings. Then drag the bar all the way down to Never notify.

Here are some additional symptoms I observed which could be helpful:

When I ran msbuild locally with IncludeIisSettings=true I received the same error as in the question.

After some frustration and wrong turns I couldn't figure out why although I am an administrator I was getting permission errors in relevant areas, e.g. when setting IncludeIisSettings=false then attempting to run the deploy file I received a permission error.

Thus I decided to explore the UAC settings and find the solution.

like image 40
absynce Avatar answered Oct 17 '22 09:10

absynce