MSBuild IIS问题 [英] MSBuild IIS issue

查看:276
本文介绍了MSBuild IIS问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MSBuild来打包和发布我的Asp.Net MVC 3,.Net 4应用程序。我已经成功地为MVC 1.0,.Net 3.5应用程序做了这个。

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.

每当我在.proj文件中包含IIS设置( IncludeIisSettings = true )时,我都会收到以下构建错误:

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):错误MSB4044:给出所需参数Text的值时,EscapeTextForRegularExpressions任务不是

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".


推荐答案

我的构建服务器上遇到了同样的问题。

I've had the same issue on my build server.

该软件包将在我的开发机器上完美构建,但是会因为我的构建服务器上出现的完全相同的错误而失败。对我来说,问题是由于我的构建机器上的应用程序未在IIS中注册。

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.

当我在项目中启用IIS Express中的本地测试时,问题就出现了,并且以某种间接方式启用 IncludeIisSettings = true 设置你提到的。这会导致Web部署管道向IIS查询站点的详细信息。由于构建服务器没有安装IIS 7或IIS Express,因此无法获取这些设置。这最终导致上述错误,因为传递给 EscapeTextForRegularExpressions 任务的参数为空。

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.

我的解决方案是在应用程序 .wpp.targets 文件中将 IncludeIisSettings 设置为 False (参见这里的示例。 wpp.targets文件)。如果您明确指定IIS的设置,那应该不是问题。

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.

我还可以通过使用WebMatrix向IIS Express注册站点来修复构建。在Visual Studio中运行该站点应具有相同的效果。

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.

这篇关于MSBuild IIS问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆