3

We are using SourceLink with c# projects and it is working just fine. When we try to use it on C++ projects the /SOURCELINK option in the linker seems to be ignored as there is no relevant metadata in the produced PDB

I am using this MSBuild:

 msbuild /version
 Enterprise
 Microsoft (R) Build Engine version 15.8.168+ga8fba1ebd7 for .NET Framework
 Copyright (C) Microsoft Corporation. All rights reserved.

 15.8.168.64424

The Linker option is documented here: /SOURCELINK

We are using it like this

/SOURCELINK:"C:\Projects\SourceLinkTest\sourcelink.json"

with a hand crafted JSON file (because our Stash is still on v4.5.2)

{"documents":
{"C:\\Projects\SourceLinkTest\\*":
    "https://stash.mycompany.com/projects/EDMPTF/repos/sourcelink/browse/*?at=ae281edb41c2da2a9375a63d8be9dd3ca00660fd&raw"
}
}

the MSBuild Link step looks like this:

Link:                                                                                                                                                                                                                                 
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\HostX86\x86\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Projects\SourceLinkTest\Debug\SourceLi  nkTest.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='fa  lse'" /manifest:embed /DEBUG:FASTLINK /PDB:"C:\Projects\SourceLinkTest\Debug\SourceLinkTest.pdb" /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Projects\SourceLinkTest\Debug\SourceLinkTest.lib" /MACHINE:X86 /SOURCELINK:"C:\Projects\SourceLinkTest\sourcelink.json" Debug\SourceLinkTest.res        
Debug\SourceLinkTest.obj                                                                                                                                                                                                            
Debug\stdafx.obj                                                                                                                                                                                                                    
SourceLinkTest.vcxproj -> 
C:\Projects\SourceLinkTest\Debug\SourceLinkTest.exe

We use Jetbrains dotPeek to check the PDB contents as the SourceLink V3 tool can only analyse portable PDBs

4

1 回答 1

2

After conversation with Microsoft developers it turns-out this is a bug. Partial fix is in VS2017 15.9.7. Full fix is in VS2019.

于 2019-02-01T09:30:16.347 回答