我见过的示例使用相对于 nuspec 文件位置的路径指定要包含的文件,例如:
<file src=".\bin\Debug\SomeFile.dll" target="..." />
Run Code Online (Sandbox Code Playgroud)
有没有办法以这样的方式指定它,它会根据我的构建配置使用适当的源目录:即:
TL; 博士
使用$configuration$令牌。
完整说明
在 .nuspec 文件参考中,在Replace Tokens 下,它将令牌定义$configuration$为:
“用于构建程序集的配置,默认为 Debug。请注意,要使用 Release 配置创建包,您始终在命令行上使用 -properties Configuration=Release。”
并继续:
当您包含程序集文件和内容文件时,令牌也可用于解析路径。令牌与 MSBuild 属性具有相同的名称,因此可以根据当前的构建配置选择要包含的文件。
然后以两个例子结束:
例如,如果您在 .nuspec 文件中使用以下标记:
<files>
<file src="bin\$configuration$\$id$.pdb" target="lib\net40\" />
</files>
Run Code Online (Sandbox Code Playgroud)
并且您使用 MSBuild 中的 Release 配置构建一个 AssemblyName 为 LoggingLibrary 的程序集,包中 .nuspec 文件中的结果行如下:
<files>
<file src="bin\Release\LoggingLibrary.pdb" target="lib\net40" />
</files>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2701 次 |
| 最近记录: |