Question

JavaScript naming convention requires version number in the file name such as jQuery.1.34.min.js, and I have text template which will output my-library.js in output folder.

I want to create NuGet Package with my-library.js in such way that on installation it should be deployed as my-library.1.34.js

If I build nuget package as part of msbuild process, there is no way I can rename my output js file.

I already have a long workaround, in which I have a console app which copies files to folder structure as given version number and then it builds a nuspec file and then it is passed onto nuget.exe, if there is any easy, I would like to avoid such long steps.

Was it helpful?

Solution

I found I could rename include files by specifying a full file name for the target.

For example (nuspec snippet):

<files>
<file src="my-library.js" target="content/my-library.$VERSION$.js">
</files> 

and nuget would be run like:

nuget.exe pack mypackage.nuspec -Prop VERSION=1.34

Note: The File extension in src and target must match or the specified target will be treated like a directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top