How do I change target filename in NuGet Package?

帅比萌擦擦* 提交于 2019-12-22 04:51:09

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/23242137/how-do-i-change-target-filename-in-nuget-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!