【问题标题】:Can I run SourceLink manually on existing PDB files?我可以在现有 PDB 文件上手动运行 SourceLink 吗?
【发布时间】:2019-01-15 12:41:15
【问题描述】:

假设我从源代码构建了一个(C++ 或 .NET)库,所以我在本地有源代码和 PDB 文件,但我不想将库代码修改为例如添加/SOURCELINKa nuget package

是否可以在命令行上运行 sourcelink 以将现有的 PDB 链接到 git 存储库?

【问题讨论】:

  • @Strom 这正是我想要做的。我从哪里开始?是否有可执行文件可以运行?

标签: sourcelink


【解决方案1】:

如果您没有修改源代码,那么可以,但是您必须手动下载 .PDB 文件并将它们包含在您编译的输出文件夹中,然后将其上传到 git 与符合的正确 .json 文件以下架构:

JSON 配置文件包含本地文件的简单映射 可以通过 http 或 https 检索源文件的 URL 的路径。 调试器将检索当前文件的原始文件路径 来自 PDB 的位置,在 Source Link 地图中查找此路径,然后 使用生成的 URL 下载源文件。

json文件的schema是:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "SourceLink",
    "description": "A mapping of source file paths to URLs",
    "type": "object",
    "properties": {
        "documents": {
            "type": "object",
            "minProperties": 1,
            "additionalProperties": {
                "type": "string"
            },
            "description": "Each document is defined by a file path and a URL. Original source file paths are compared 
                             case-insensitively to documents and the resulting URL is used to download source. The document 
                             may contain an asterisk to represent a wildcard in order to match anything in the asterisk's 
                             location. The rules for the asterisk are as follows:
                             1. The only acceptable wildcard is one and only one '*', which if present will be replaced by a relative path.
                             2. If the file path does not contain a *, the URL cannot contain a * and if the file path contains a * the URL must contain a *.
                             3. If the file path contains a *, it must be the final character.
                             4. If the URL contains a *, it may be anywhere in the URL."
        }
    },
    "required": ["documents"]
}

不幸的是,除了原始帖子中不允许的/SOURCELINK 之外,我还没有找到用于创建这些文件的命令行实用程序。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-06-03
    • 1970-01-01
    • 1970-01-01
    • 2014-05-04
    • 2016-01-13
    • 2020-03-21
    • 1970-01-01
    相关资源
    最近更新 更多