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?