gpt4 book ai didi

nuget - 如何在 nuspec 中指定特定于配置的文件夹

转载 作者:行者123 更新时间:2023-12-04 11:43:17 26 4
gpt4 key购买 nike

我见过的示例使用相对于 nuspec 文件位置的路径指定要包含的文件,例如:

<file src=".\bin\Debug\SomeFile.dll" target="..." />

有没有办法以这样的方式指定它,它会根据我的构建配置使用适当的源目录:即:
  • bin\Debug 如果我用 -Prop Configuration=Debug
  • 打包
  • bin\Release 如果我用 -Prop Configuration=Release 打包
  • 最佳答案

    TL;博士

    使用 $configuration$ token 。

    完整说明

    在 .nuspec 文件中 reference , 下 更换 token ,它定义了 $configuration$ token 为:

    "Configuration used to build the assembly, defaulting to Debug. Note that to create a package using a Release configuration, you always use -properties Configuration=Release on the command line."



    并继续:

    Tokens can also be used to resolve paths when you include assembly files and content files. The tokens have the same names as the MSBuild properties, making it possible to select files to be included depending on the current build configuration.



    然后以两个例子结束:

    For example, if you use the following tokens in the .nuspec file:


    <files>
    <file src="bin\$configuration$\$id$.pdb" target="lib\net40\" />
    </files>

    And you build an assembly whose AssemblyName is LoggingLibrary with the Release configuration in MSBuild, the resulting lines in the .nuspec file in the package is as follows:


    <files>
    <file src="bin\Release\LoggingLibrary.pdb" target="lib\net40" />
    </files>

    关于nuget - 如何在 nuspec 中指定特定于配置的文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40628116/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com