My release pipeline deploys the application to multiple environments.
Based on the environment, I am trying to set up File Transformations to be executed, though I\'m n
How to apply XML File Transformations on a ClickOnce application through Azure DevOps release pipeline?
File Transform task should work well in your scenario if we can meet its prerequisites:
1.Make sure the transform file(app.Release.config) and the source file({nameOfApplication}.exe.config) are in same path.
2.Make sure your transform file has correct xdt syntax, sample here.
3.Choose latest 2.0-preview
version of File Transform task instead of old 1.0
.
4.Try using valid file name when setting Xml Transformation rules
.(Use {nameOfApplication}.exe.config
instead of *.exe.config
)
In my opinion, #1
and #3
above are always the direct cause of the error Unable to apply transformation for the given package
. Check them carefully!
Some details for above four tips:
1.In project file(xx.csproj) I have this content to make sure the transform file will be copied to output folder. So it will be in same folder with source file xxx.exe.config
.
PreserveNewest
2.My test App.config:
My test App.release.config:
3.Use latest version which fixes some issues:
4.According to some tests, valid name works better than something like *.exe.config
when you already know the application name:
Hope all above helps :)