Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet : How can i apply transform to .csdef file of Cloud project

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

like image 852
Arun Rana Avatar asked Dec 13 '11 10:12

Arun Rana


1 Answers

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?

like image 96
Xavier Decoster Avatar answered Oct 18 '22 18:10

Xavier Decoster