GitTools / GitLink

Making .NET open source accessible!
MIT License
555 stars 86 forks source link

A short novel on actually getting this to work cross platform/dotnet cli #159

Open cphillips83 opened 7 years ago

cphillips83 commented 7 years ago

I wanted to drop this here, for one to express my pain and two hopefully it can be used to help others or update the faq.

Just a little background I have a simple dotnet project created via dotnet cli tool. I've set it up to produce multiple outputs on build as well (supporting desktop and core), it can be found at https://github.com/MindMatrix/MongoRepository2.

I came across this from somewhere I can't even remember at this point and I landed on the default page (develop). I spent an hour trying to figure out why I couldn't get anything to work that seemed so simple until I found a closed issue that said "you are probably reading the default develop instead of master".

The next issue I ran in to was with debugging set to portable, I switched it to full (works) and pdbonly for release (doesn't work). I spent hours trying to figure out how "all you do is add the nuget package and build!" and have never got it to work a single time so I resorted to chocolately and using -pre on the gitlink package.

The next issue I ran in to is that dotnet pack by default builds (where nuget pack has you pass a param to build), this lead to my pdb's that I thought were gitlinked, not being.

That moment when I hit F11 and finally seen my code step in to a file part of my nuget package had me yell a short lived HOORAY! Mousing over the file path quickly showed that it was simply loading the file from where I built the nuget package. At this point I've spent 4 hours on this and said well the only thing left is to simply rename that src folder for the hell of it just to see if its somehow looking there first and sure enough it started pulling from github instead.

Its 1AM and I know this isn't really an issue and more of a novel, but I'm hoping it can help or some how be deciphered in to useful tidbits of what I went through to get this setup. I have yet to figure out how to make it part of dotnet build and just added it as step in the CI.

Oh I also forgot to mention that dotnet pack uses PDBs from the obj folder and not the release (sprinkle this somewhere through out this mess). Perhaps thats the behavior when passing --no-build.

EDIT: Adding gitlink via nuget to a project that you plan to package will of course make it a dependency when you then include that package you just created in your project. Might be obvious but I only have about a month experience right now with creating packages and that was all VSTS.

GeertvanHorrik commented 7 years ago

Thanks for sharing your experience. We're sorry it was such a pain to get this working in the first place. We just released GL 3.0 stable (so develop, the default readme) should now reflect the right behavior.