I am creating NuGet Package and facing one issue that how can i apply transformation to file that is not web.config or app.config , i would like to make transformation to ServiceDefination.csdef file that's why i have put file named as ServiceDefination.csdef.transform in /content folder.
When i am trying to install that nuget simply make copy of that file in root named as ServiceDefination.csdef.transform.txt
Can i apply transformation to .csdef file or is it limited to web.config & app.config?
thanks
The nuget config transformations actually work on ANY XML file using the same *.transform convention (except for packages.config, for which there are other hacks/workarounds).
If you simply need to transform (read: add/merge changes into) the csdef file, this should work.
If not, you can attempt the PowerShell route and modify the target file using an XML template file embedded in your package. If you need inspiration on how to do so, you can find an example package which generates a certain XML file (actually a nuspec file) here: https://github.com/myget/NuGetPackages/blob/master/NuSpec/tools/init.ps1
Also, if the question still stands, could you please mention which version of nuget you are using?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With