Web部署的TFS 2012构建定义将忽略项目文件中定义的参数 [英] TFS 2012 Build Definition for web deployment ignores parameters defined in project files

查看:116
本文介绍了Web部署的TFS 2012构建定义将忽略项目文件中定义的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试建立一个TFS 2012构建定义,该定义将构建一个解决方案并在该解决方案中部署多个Web应用程序。我遇到了这篇文章似乎完全解决了我正在尝试做的事情,并且似乎也同意提到的解决方案

所以我尝试实现如该文章中所述的构建定义/项目配置,但无论我做什么,似乎都忽略了我放在csproj文件的特定配置属性组中的参数,如下所示:

 < PropertyGroup Condition ='$(Configuration)| $(Platform)'=='MyConfig | AnyCPU'> 
...
< DeployIisAppPath>我的网站名称< / DeployIisAppPath>
< MsDeployServiceUrl> MyWebServer< / MsDeployServiceUrl>
< / PropertyGroup>

我尝试部署的每个项目都会收到以下错误:

  Web Deploy发布/程序包验证错误:$(MsDeployServiceUrl)


所以我尝试在生成定义的MSBuild参数中而不是在csproj文件中定义MsDeployServiceUrl。这样就解决了上面的错误,但是然后我得到了这个错误:

  ConcatFullServiceUrlWithSiteName任务没有获得所需的值参数 SiteAppName。 

所以它也不从csproj文件中读取DeployIisAppPath参数,因此我无法将其移至MSBuild Arguments行,因为它与我要部署的每个项目都不同。



几乎就像部署过程没有意识到我要构建的配置一样,因此它无法在csproj文件中找到正确的PropertyGroup来读取参数。但是,我在构建定义的要构建的配置行中指定了配置,并且我还尝试将/ p:Configuration = MyConfig添加到MSBuild Arguments行中,但这似乎无法解决问题。



更新:



好的,似乎TFS无法识别解决方案中定义的配置。当我在构建定义中选择要构建的配置时,对话框中配置列中的下拉列表仅显示默认的调试和发布。我们在解决方案中定义了六种左右的其他配置,这些配置没有显示。我尝试手动输入配置,甚至再次检查拼写是否正确。它可以构建,但使用的配置不正确(应用了错误的Web.config转换)。这就解释了为什么它不从项目文件中正确的PropertyGroup中读取构建属性。



我们的TFS安装/配置是否会出现问题?解决方案定义的配置应该显示在该下拉列表中,还是您始终总是必须第一次手动键入自定义配置名称?

解决方案

我设法通过从Configuration Manager中删除/重新创建我们所有的解决方案/项目配置来自己解决了这个问题



显然,我们的解决方案配置存在问题从构建定义中搞砸了使用它们的尝试。我最好的猜测是,在创建它们时,它们是从现有配置中复制/粘贴的,但是在此过程中遗漏了一些东西,它们仍然以某种方式指向原始源配置。但是我不是最初创建它们的人,所以我不确定到底出了什么问题。



无论如何,我为每个配置保存了PropertyGroup XML的备份从每个项目文件中删除,然后通过Configuration Manager从解决方案和每个项目中完全删除每个配置。然后,我重新创建了每个配置,并从备份中恢复了每个项目中的PropertyGroup。现在,我的构建定义是从正确的PropertyGroups中读取构建属性,并在Web.config上执行正确的转换。


I'm trying to set up a TFS 2012 build definition that will build a solution and deploy several web apps within the solution. I came across this article that seems to address exactly what I'm trying to do and also seems to agree with the solution mentioned here.

So I tried implementing the build definition/project configuration as described in that article, but no matter what I do, it seems to be ignoring the parameters I put in the specific configuration property group of the csproj files which look like this:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'MyConfig|AnyCPU' ">
  ...
  <DeployIisAppPath>My Website Name</DeployIisAppPath>
  <MsDeployServiceUrl>MyWebServer</MsDeployServiceUrl>
</PropertyGroup>

I get the following error for each project I’m trying to deploy:

Web Deploy publish/package validating error: Missing or Invalid property value for $(MsDeployServiceUrl)

So I tried defining the MsDeployServiceUrl in the MSBuild Arguments of the build definition instead of in the csproj files. This solved the above error, but then I get this error:

The "ConcatFullServiceUrlWithSiteName" task was not given a value for the required parameter "SiteAppName".

So its not reading the DeployIisAppPath parameter from the csproj file either, and I can’t move that to the MSBuild Arguments line because its different for each project I’m trying to deploy.

Its almost as if the deployment process is unaware of which configuration I’m building, so it can’t find the correct PropertyGroup in the csproj files to read the paramters from. However, I have specified the configuration in the "Configurations to Build" line of the build definition, and I’ve also tried adding /p:Configuration=MyConfig to the MSBuild Arguments line, and that doesn’t seem to solve the problem.

Update:

Ok, it seems like TFS doesn't recognize the Configurations defined in the solution. When I go to select "Configurations to Build" in the build definition, the drop-down list in the Configuration column in the dialog is only showing the default "Debug" and "Release". We have a half dozen or so other configurations defined in our solution that aren't showing up. I tried typing in the configuration manually, and even double checked that the spelling was correct. It builds, but doesn't use the right configuration (The wrong Web.config transform is applied). This explains why its not reading the build properties from the correct PropertyGroup in the project files.

Could this be a problem with our TFS installation/configuration? Should the solution-defined configurations show up in that drop-down list, or do you always have to manually type in custom configuration names the first time?

解决方案

I managed to solve this issue myself by removing/recreating all our solution/project configurations from Configuration Manager

Apparently something was wrong with our solution configurations that screwed up attempts to use them from a build definition. My best guess is that when they were created, they were copy/pasted from an existing configuration, but something was missed in the process and they were still somehow pointing to the original source configuration. However I was not the one who originally created them, so I can't be sure exactly what went wrong.

Anyway, I saved backups of the PropertyGroup XML for each configuration from each project file, then completely removed each configuration from the solution and each project via Configuration Manager. I then recreated each configuration, and restored the PropertyGroups in each project from my backups. Now my build definitions are reading the build properties from the correct PropertyGroups, and performing the correct transform on Web.config.

这篇关于Web部署的TFS 2012构建定义将忽略项目文件中定义的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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