cpiock
cpiock

Reputation: 1304

Web.config Transformation during Build

I have set up my build on Visual Studio Team Services but looks like that the Web.config transformation of my Web.Release.config doesn't work and I receive only the standard Web.config. What I do wrong or what parameter I miss.

enter image description here

Upvotes: 0

Views: 1708

Answers (2)

cpiock
cpiock

Reputation: 1304

The profile want work for me on the build server. I found this solution that works for me.

/p:outdir=$(build.artifactstagingdirectory)\Release /p:UseWPP_CopyWebApplication=true /p:PipelineDependsOnBuild=false

This part makes the difference:

/p:UseWPP_CopyWebApplication=true 

Upvotes: 0

Scott Chamberlain
Scott Chamberlain

Reputation: 127603

For the transformation to happen msbuild needs to "deploy" the solution. I am not sure of the most correct way to do it, but a easy workaround would be add

/p:DeployOnBuild=true /p:PublishProfile=SomeProfile

to the MSBuild Arguments option. You can then grab the files from wherever you configured the publish profile to put them and use those during your deployment.

Here is a very simple example of a SomeProfile.pubxml file that would put the published files in the artifact staging directory.

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>$(BUILD_ARTIFACTSTAGINGDIRECTORY)\Release</publishUrl>
    <DeleteExistingFiles>False</DeleteExistingFiles>
  </PropertyGroup>
</Project>

Using the MSBuild command args in TFS

/p:DeployOnBuild=true /p:PublishProfile=SomeProfile

dropping the /p:outDir.

Upvotes: 3

Related Questions