Arun Rana
Arun Rana

Reputation: 8606

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

Upvotes: 7

Views: 640

Answers (1)

Xavier Decoster
Xavier Decoster

Reputation: 14810

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?

Upvotes: 2

Related Questions