I have a project in TeamCity that pulls in a VS2013 project, builds it and then packs it wil OctoPack (setting Run OctoPack is enabled in the build step).
Now the creation of the nuget package works fine, it is pushed in the nuget feed and octpack creates a release for me, this all works.
But when I look in the nuget file I see that there is only 1 web.config transform file, I have about 10 web.config transforms files, each for a separate release.
How can I make sure OctoPack packs all the transformation files so it can make multiple releases from a single buid?
Is the Build Action, in the VS project, for each of the missing files set to Content?
You are right, it wasn’t. Put the build action to Content and now I can transform my files.
Yep this worked for me too, but now I have the issue that I have all the transform files in all the environments. Meaning the prod. transform file is in the dev. deployment and so on (the regular web.config is transformed correct but the transform files are still there)
Meaning that the prod. information can be found on the dev and test server which is not a good idea security wise.
Any idea how to solve that?
Thanks for reaching out.
You can solve this by adding a Pre-Deploy script in your package step that deletes all the unwanted transform files using the cmdlet
If you want to make this even more stable, you could create a project variable called “TransformFile” per environment which has the name of your transform file (see attached screenshot). Then in your Pre-deployment script you could do something like
Remove-Item *transform.config -exclude $TransformFile to delete all the transform files except the one that belongs to the current environment.
Let me know if that approach makes sense to you.