Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

What am I doing wrong? #140

Open
phatcher opened this issue Feb 5, 2017 · 15 comments
Open

What am I doing wrong? #140

phatcher opened this issue Feb 5, 2017 · 15 comments

Comments

@phatcher
Copy link

phatcher commented Feb 5, 2017

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.

@v-jacai
Copy link
Contributor

v-jacai commented Feb 6, 2017

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

@phatcher
Copy link
Author

phatcher commented Feb 6, 2017

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.

@gep13
Copy link
Member

gep13 commented Feb 6, 2017

@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.

@phatcher
Copy link
Author

phatcher commented Feb 6, 2017

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

@gep13
Copy link
Member

gep13 commented Feb 6, 2017

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.

@phatcher
Copy link
Author

phatcher commented Feb 6, 2017

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?

@gep13
Copy link
Member

gep13 commented Feb 6, 2017

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 😄

@AArnott
Copy link
Contributor

AArnott commented Feb 6, 2017

@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.

@phatcher
Copy link
Author

phatcher commented Feb 7, 2017

@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

@AArnott
Copy link
Contributor

AArnott commented Feb 8, 2017

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

@phatcher
Copy link
Author

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

@AArnott
Copy link
Contributor

AArnott commented Feb 16, 2017

@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?

@phatcher
Copy link
Author

@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?

@AArnott
Copy link
Contributor

AArnott commented Feb 16, 2017

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

@phatcher
Copy link
Author

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants