nuget用法为C++,如何复制源路径目录结构?

ldxq2e6h  于 2023-06-25  发布在  其他
关注(0)|答案(1)|浏览(149)

我正在为C++构建nuget包。构建本身在服务器上使用jenkins执行。输出文件的布局如下:

D:/jenkins/workspace/myworkspace/build/Debug/package/lib/mylib.lib
D:/jenkins/workspace/myworkspace/build/Release/package/lib/mylib.lib
D:/jenkins/workspace/myworkspace/build/Release/package/include/subdir1/include1.h
D:/jenkins/workspace/myworkspace/build/Release/package/include/subdir2/include2.h

.nuspec看起来像这样:

<files>
 <file src="mylib.props" target="build\native\"/>
 <file src="build/Release/package/include/**/*" target="build\native"/>
 <file src="build/Release/package/lib/mylib.lib" target="build\native\lib\x64\Release"/>
 <file src="build/Debug/package/lib/mylib.lib" target="build\native\lib\x64\Debug"/>
</files>

打包完成后,在包内部,包含文件夹被打包,但布局为build/native/include/build/Release/package/include***。由于我使用复制目录结构,nuget也会复制上半部分。有没有办法更改基本目录,使路径变为build/native/include*

3qpi33ja

3qpi33ja1#

在nuget中有一个bug。未正确处理正斜杠(/)。所以下面的工作和预期的一样

<files>
 <file src="mylib.props" target="build\native\"/>
 <file src="build\Release\package\include\**\*" target="build\native"/>
 <file src="build\Release\package\lib\mylib.lib" target="build\native\lib\x64\Release"/>      
 <file src="build\Debug\package\lib\mylib.lib" target="build\native\lib\x64\Debug"/>     
</files>

相关问题