0

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

3
  • I have never played with it with the TFS build but inside visual studio the transform only gets applied when you do a Deploy the config that is created when you just do a Build is the untransformed version. Commented Jan 11, 2017 at 16:36
  • it runs a command like this msbuild.exe "myProject.sln" /p:Configuration=Release /p:platform="Any CPU" /p:VisualStudioVersion="15.0" Commented Jan 11, 2017 at 16:42
  • See this quuestion and answer stackoverflow.com/questions/13920146/… Commented Jan 11, 2017 at 16:44

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

4 Comments

hmm on my build server i don't need a publishprofile because the copy to the azure server does the Release Management of Visual Studio Team Service
Perhaps create a profile that drops the transformed files in to $(BuildArtifactStagingDirectory)\Release and get rid of the /p:outDir in your build step. Profiles are just MSBuild scripts themselves and should be able to use the global variables.
ok. locally by setting a fixed path it works. how can i set the $(BuildArtifactStagingDirectory) in the profile configuration?
@cpiock added a example pubxml file that should work. Just create a new profile from inside visual studio then open the pubxml file and edit it as needed to have the settings you want.
0

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 

1 Comment

Since you solved the issue by yourself, you can mark it as answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.