[英]Mono xbuild: Copy debug symbols from NuGet packages folder into output bin folder
When using NuGet packages which include symbols, Visual Studio is copying these debug symbol files ( *.pdb
) right into the bin output folder. 使用包含符号的NuGet包时,Visual Studio会将这些调试符号文件(
*.pdb
)直接复制到bin输出文件夹中。
This does not happen when using NuGet and xbuild
on Linux using Mono - the pdb
files are not copied to the output folder. 使用的NuGet当这不会发生
xbuild
使用单在Linux上-在pdb
文件不会被复制到输出文件夹。
Is there any way to let xbuild
mimic the pdb-copying behavior of Visual Studio? 有什么方法可以让
xbuild
模仿Visual Studio的pdb复制行为吗?
For now I was able to achieve what I wanted by writing this script, which also converts the pdb files to mdb (requires pdb2mdb
to be in the path): 现在,我可以通过编写此脚本来实现所需的功能,该脚本还将pdb文件转换为mdb(要求
pdb2mdb
位于路径中):
#!/bin/bash
PACKAGE_PATH_SUBSTR=$1
CSPROJ=$2
OUT_DIR=$3
# 1.) search for file references in the .csproj file with the help of the partial nuget package path name
# 2.) replace .dll with .pdb
# 3.) replace all left <HintPath> and </HintPath> tags
# 4.) replace windows path separators (\) with unix ones (/)
PDB_CANDIDATES=$(grep -oP '<HintPath>(.*'${PACKAGE_PATH_SUBSTR}'.*\.dll)</HintPath>' $CSPROJ | sed -e "s/\.dll/\.pdb/g" | sed -e 's/<\(\/\)\{0,1\}HintPath>//g' | sed -e 's/\\/\//g' )
# loop through all possibly existent pdb file names
for item in ${PDB_CANDIDATES}; do
# check if the pdb file candidate really exists
if [ -e $item ]; then
# pdb exists, copy it to the bin output path
cp -v ${item} ${OUT_DIR}
# convert pdb to mdb
pdb2mdb ${OUT_DIR}/$(basename $(echo $item | sed -e 's/\.pdb/.dll/g') )
# if you wanted you could delete the pdb file now.
fi
done
Usage: copy_pdb_from_nuget.sh packages MyProject.csproj ./bin
用法:
copy_pdb_from_nuget.sh packages MyProject.csproj ./bin
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.