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.