代码之家  ›  专栏  ›  技术社区  ›  Boinst

我可以在现有PDB文件上手动运行sourceLink吗?

  •  1
  • Boinst  · 技术社区  · 7 年前

    假设我已经从源代码构建了一个(c++或.net)库,所以我在本地有源码,我有PDB文件,但是我不想把库代码修改为 /SOURCELINK a nuget package .

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

    1 回复  |  直到 7 年前
        1
  •  1
  •   Strom    7 年前

    如果您没有修改源代码,那么是的,有点类似,但是您必须手动下载.pdb文件并将其包含在编译的输出文件夹中,然后使用符合以下模式的正确.json文件将其上载到git:

    JSON配置文件包含本地文件的简单映射 可通过HTTP或HTTPS检索源文件的URL路径。 调试器将检索当前 从PDB的位置,在源链接映射中查找此路径,以及 使用生成的URL下载源文件。

    JSON文件的模式是:

    {
        "$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 在原来的帖子里。

    推荐文章