webdevbing
webdevbing

Reputation: 332

Config Transform in Azure DevOps

I would like to use a visual studio proj file to transform xml files. I am following this article. http://sedodream.com/2010/04/26/ConfigTransformationsOutsideOfWebAppBuilds.aspx . This works for me locally, however when deploying the application on Azure DevOps it fails. It cannot find Microsoft.Web.Publishing.Tasks.dll. How do I set up a build task that will only transform the config files.

<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <UsingTask TaskName="TransformXml"
             AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>
    <Target Name="Build">
        <TransformXml Source="Web.config"
                      Transform="Web.Release.config"
                      Destination="Web.Production.config" />
    </Target>
</Project>

Upvotes: 0

Views: 465

Answers (2)

webdevbing
webdevbing

Reputation: 332

Turned out to be an easy fix. It was an old build so that the hosted agent. Just had to change it to the Hosted VS2017 agent.

Upvotes: 1

LoLance
LoLance

Reputation: 28216

AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>

I think that's why the issue happens. For a vs2017 agent, you need to change the v10.0 to v15.0, so that the msbuild tool can find the assembly.

Also, as for vs2017, make sure you set the correct msbuild tool path in VSTS like this issue.

Upvotes: 0

Related Questions