GitLink icon indicating copy to clipboard operation
GitLink copied to clipboard

What am I doing wrong?

Open phatcher opened this issue 8 years ago • 15 comments

Steps to reproduce

  1. Followed the instruction on the getting started page, adding the NuGet package to each project
  2. Build the project

Platform: .NET version: 4.5

Expected behaviour

Should have the symbols replaced

Actual behaviour

Symbol still pointing locally

Code is available at https://github.com/phatcher/Meerkat.Security

Also some advice on how incorporate into a FAKE script without adding the NuGet package would be nice.

phatcher avatar Feb 05 '17 11:02 phatcher

Do you see the *.srcsrv file in the folder? If so, you can open the symbol file in the Notepad.

v-jacai avatar Feb 06 '17 04:02 v-jacai

No, I can see that I have gitlink in the packages as a developmentDependency and a binary reference in the project., but that's it - there's no change to the project's build targets so I don't see how it's going to achieve anything.

phatcher avatar Feb 06 '17 05:02 phatcher

@phatcher can you confirm which NuGet Package you have installed?

Sounds like you have added this one:

https://www.nuget.org/packages/gitlink/

Which contains the exe and pdb, where as I think you want this one:

https://www.nuget.org/packages/gitlinktask/

which contains the exe, dll, pdb and associated targets file.

gep13 avatar Feb 06 '17 06:02 gep13

I do have gitlink - that's what the front page says to install.

Just tried to use gitlinktask and it wouldn't install into my project (which is .NET 4.5) - I notice the package does not have a lib folder

install-package : Could not install package 'gitlinktask 2.4.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. At line:1 char:1

  • install-package GitLinkTask

phatcher avatar Feb 06 '17 06:02 phatcher

The issue that you are seeing is that the readme in the develop branch (which is the default branch) tells you about the new, soon to be released version of GitLink, and not the one that is currently pushed to nuget.org, i.e. 2.4.1.

I would point you here:

https://github.com/GitTools/GitLink/tree/master

For information about the GitLink and GitLinkTask packages which are currently pushed to NuGet.org.

gep13 avatar Feb 06 '17 06:02 gep13

Ah thanks, hadn't noticed that I was on the develop branch, so at the moment it has to process the source and the new one will process the pdb directly?

phatcher avatar Feb 06 '17 07:02 phatcher

I would need @GeertvanHorrik or @AArnott to confirm that one. Personally, I run GitLink through a Cake task:

https://github.com/cake-contrib/Cake.Recipe/blob/develop/Cake.Recipe/Content/gitlink.cake#L9

So I haven't used the approach that you are describing, I just know about it's existence 😄

gep13 avatar Feb 06 '17 08:02 gep13

@phatcher: yes, the gitlink in the develop branch can just be given the pdb file and it will do all the work without a bunch of the other integration with MSBuild. If you want to try out what's in GitLink's develop branch, since we don't yet have a nuget package of it released, you could temporarily install the PdbGit nuget package instead of GitLink (which is basically GitLink's develop branch at the moment) and see if that "just works" for you. Either way, that can be good feedback for GitLink going forward.

AArnott avatar Feb 06 '17 21:02 AArnott

@AArnott I'll have a go at that and get back to you - will make it easier to integrate into my Fake build script as it would just be another task after the tests but before the nuget pack

phatcher avatar Feb 07 '17 10:02 phatcher

Why add a task at all? So long as you're using MSBuild to compile your projects, PdbGit does it as part of that.

AArnott avatar Feb 08 '17 00:02 AArnott

I need it as a separate task as it operates on the pdbs in the build directory, so I do the task after the tests are run successfully but before the pack.

You end up with something like...

Target "SourceLink" (fun _ ->
    let PdbGit = (fun pdbFile -> 
        let result = ExecProcess(fun info ->
            info.FileName <- "./packages/build/pdbgit/tools/pdbgit"
            info.Arguments <- pdbFile)(TimeSpan.FromMinutes 2.0)
        if (result <> 0) then
            failwithf "pdbgit returned with non-zero exit code"
    )

    PdbGit (buildDir + "/MyAssembly.pdb")
)

I notice that it only takes a single file i.e. it won't accept a filespec *.pdb which might be a useful change, though I suppose you'd have to be careful specifying it so you don't process for third-party assemblies

phatcher avatar Feb 16 '17 14:02 phatcher

@phatcher what you're doing and asking for makes sense. But I still don't understand why you can't do it as part of your msbuild. You say you rewrite the PDB after tests pass, but why not do it when the PDB is first created? In the future, Roslyn compilers will support passing data to the compiler so that the PDB has source server support without rewriting, which would mean this is all front-loaded, very similar to pdbgit doing it directly after compilation. So what is your concern with doing this write after compilation?

AArnott avatar Feb 16 '17 17:02 AArnott

@AArnott Sorry I think I was misunderstanding - couldn't see how I can pass this as an argument to MSBuild.

Do I basically install this as a solution-level package and it adds targets to the solution to do the source indexing?

phatcher avatar Feb 16 '17 17:02 phatcher

Almost. Install the package to each of your individual projects.

AArnott avatar Feb 16 '17 18:02 AArnott

Thanks

phatcher avatar Feb 16 '17 18:02 phatcher