简体   繁体   中英

TeamCity config transform error

I'm trying to switch out a web config file using team city so that each deployment has the correct settings.

I've added an AfterBuild target in my .csproj file

  <Target Name="AfterBuild">
    <Delete Files="$(TargetDir)$(TargetFileName).config" />
    <Copy SourceFiles="$(ProjectDir)\Config\Web.$(Configuration).config" DestinationFiles="$(TargetDir)$(TargetFileName).config" />
  </Target> 

and then called this in team city in the "Targets" section of a visual studio solutions runner.

I keep getting this error when the team city build happens:

"error MSB4057: The target "AfterBuild" does not exist in the project."

Does anyone know why I might be getting this issue?

Thanks

Feel free to use this powershell build step to help with config transformations

1. Create a PowerShell script and add it to version control

Use the following script - xdt-config-transform.ps1

2. Add Microsoft.Web.XmlTransform.dll to your version control in the same location as the PowerShell script. This file should be on your local disk if you have Visual Studio installed

3. Create a PowerShell build step to do the transformation

建立步骤

4. Pass in the parameters to the script

在此处输入图片说明

5. Define the values for the parameters

This is the path to the config file you wish to transform 配置文件

This is the path to the config file that holds the transformations 配置转换文件

This is the path to the Microsoft.Web.XmlTransform.dll file 库文件

The additional parameters support a simple find and replace functionality that we needed at some point, but you could strip this out.

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM