如何更改NuGet软件包中的目标文件名? [英] How do I change target filename in NuGet Package?
问题描述
JavaScript命名约定要求文件名中的版本号为jQuery.1.34.min.js
,并且我有文本模板,该模板将在输出文件夹中输出my-library.js
.
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.
我想用my-library.js
创建NuGet软件包,以便在安装时将其部署为my-library.1.34.js
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
如果我在msbuild过程中构建nuget包,则无法重命名我的输出js文件.
If I build nuget package as part of msbuild process, there is no way I can rename my output js file.
我已经有一个很长的解决方法,其中有一个控制台应用程序,该控制台应用程序将文件复制到给定版本号的文件夹结构中,然后构建一个nuspec
文件,然后将其传递到nuget.exe
(如果有)容易,我想避免这么长的步骤.
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.
推荐答案
我发现我可以通过为目标指定完整的文件名来重命名包含文件.
I found I could rename include files by specifying a full file name for the target.
例如( nuspec片段):
<files>
<file src="my-library.js" target="content/my-library.$VERSION$.js">
</files>
和nuget的运行方式如下:
and nuget would be run like:
nuget.exe pack mypackage.nuspec -Prop VERSION=1.34
注意: src中的文件扩展名和目标必须匹配,否则指定的目标将被视为目录.
Note: The File extension in src and target must match or the specified target will be treated like a directory.
这篇关于如何更改NuGet软件包中的目标文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!