7

I am using the File Transform V2 task on my release pipeline for my ClickOnce application deployment.

-transform **\*.Release.config -xml **\*exe.config.deploy

I've never had issues transforming and deploying ClickOnce applications in this manner, however, for some reason, when transforming this particular application, I keep getting the following error:

Unable to apply transformation for the given package - Changes are already present in the package.

I double checked my build pipeline to make sure the transforms weren't being performed at this step, and it doesn't seem like it is. Is there a way to guarantee that transforms on an app.config do not happen from within the build pipeline, just in case?

Outside of that, I have no clue as to what the issue could be. There is no other transform step anywhere within any of my pipelines, so there shouldn't be any reason for it to be preemptively transforming, at least from what I can see.

The weird part is that even though it says that it has been transformed already, it looks to me that no transform had happened at all. All the strings and values are still the same within the app.config.

If anyone has any ideas, or needs me to provide specific logs/information, please let me know.

Andrew
  • 87
  • 1
  • 7
  • Can you share with us your build definition? And transformation rules? – Krzysztof Madej Apr 21 '20 at 07:58
  • This actually is path-related issue, just make sure the system can find the specific xx.exe.config.deploy file, the error would go away~ – LoLance Apr 21 '20 at 09:03
  • So this is a case of this issue right https://github.com/microsoft/azure-pipelines-tasks/issues/11322 ? – Krzysztof Madej Apr 21 '20 at 09:25
  • 1
    @KrzysztofMadej Hmm, they have a bit difference. That one is `verify the following` and this one is `changes already persent`. The error message `Unable to apply transformation for the given package. Verify the following.` is not simple path-related issue. The issue in GitHub link could be related to the trans rule(syntax in transform.config), task version or what. Instead i think the issue in github is similar to [this one](https://stackoverflow.com/questions/61064440/how-to-apply-xml-file-transformations-on-a-clickonce-application-through-azure-d). – LoLance Apr 21 '20 at 09:42
  • You're right. Thanks! – Krzysztof Madej Apr 21 '20 at 09:53

2 Answers2

5

I reproduced the issue and found it only occurred when the task couldn't find the source file, see:

enter image description here

1.It seems that you're using something like -xml **\*exe.config.deploy in your trans rule, try using **\*.exe.config.deploy instead of **\*exe.config.deploy.

(Or use valid name like Name.exe.config.deploy, it works well on my side)

2.And if suggestion above can't resolve your issue, you should also check the Package or folder (folderPath in yaml) input of your File Transform task. Make sure the system can find the xx.exe.config.deploy file in correct folder.

(Normally the folder would be $(System.DefaultWorkingDirectory), but not sure if you did some changes so the file was in another directory...)

LoLance
  • 25,666
  • 1
  • 39
  • 73
  • This was it! I, for some reason, had another file in the folder with the same match pattern as I had above - i.e., "**\exe.config.deploy". I changed the match pattern to point directly to the file itself and the transformation had no issues. This was simply an oversight on my end. Thanks for the help! – Andrew Apr 21 '20 at 12:21
  • Glad to know it helps :) – LoLance Apr 22 '20 at 01:28
  • @LoLance I am running into the same problem but not able to solve it. I am using a simple valid name like -transform Web.config -xml see sample shot (https://paste.pics/DSX18) and it seems that path is correct – Usman Asif Sep 08 '21 at 10:12
0

Transformation Rules:

-transform **\App.Release.config -xml **\Name.exe.config -result **\Name.exe.config

Target Files:

**\Name.exe.config

In the output it might say, skipped updating file, but if you check the output, the file is updated