simpleinjector / SimpleInjector

An easy, flexible, and fast Dependency Injection library that promotes best practice to steer developers towards the pit of success.
https://simpleinjector.org
MIT License
1.22k stars 152 forks source link

Enable source link support. #884 #885

Open davidroth opened 3 years ago

davidroth commented 3 years ago

These are the changes which are required for source link. (https://github.com/simpleinjector/SimpleInjector/issues/884) For information about the properties, see https://github.com/dotnet/sourcelink/blob/master/docs/README.md

I can rename the $(GITHUB_ACTIONS) variable, since you do not use Github_Actions or any other CI system. How do you publish SimpleInjector? Locally from your PC?

When using dotnet pack, the following packages are created:

You can open SimpleInjector.[version].nupkg in Nuget Package explorer. Notice the difference between the new package (left) and the old (right). Lots of green checks indicating that everything is ok. ✔

image

More important, stepping into SimpleInjector source is now possible 🤘

image

Thats all :-)

dotnetjunkie commented 3 years ago

Thanks for this PR. I, indeed, publish the libraries from my local PC.

looking at your PR, however, I realize that more changes might be required to set this up, because currently NuGet packages are not built using dotnet pack. This is mainly for historical reasons, but also because of customizations in the NuGet package that are not supported by dotnet pack (probably main thing is lack of allowing to add a upper limit in package references, although this does not apply for the core library itself). Instead, currently this is done using a manually crafted template that gets copied, updated, appended, and zipped using the build script.

I'm not married with the way it is currently done. As a matter of fact, it is pretty ugly and if we can replace it with a simple dotnet pack command, the better. But this might take some more testing to make sure the packages are constructed identically.

I'll keep this PR open and get back to this after I were able to update packaging to dotnet pack.

Thanks again.

davidroth commented 3 years ago

@dotnetjunkie Any updates on this? With the new "External Sources" supports of VS 2022, this gets even more interesting ;-)

dotnetjunkie commented 3 years ago

No progress on this. Don't expect this feature any time soon, considering my current time constraints.

If you want to speed things up, you could cook up a (second) pull request that allows the NuGet packages in the main repository to be auto-generated. Although, on itself, this isn't that hard, the catch here are the NuGet package dependencies. The SimpleInjector.Packaging v5.x package, for instance, should not be able to depend on SimpleInjector v6.x. Although this is something that can be configured in the package's nuspec file, the VS package generator does not support this feature. So you'll have to come up with a way to circumvent this, because this is an important configuration of a package.

With that in place, source link can be added on top.

dotnetjunkie commented 2 years ago

I reopened this issue because, although there is no progress in this regard, source link support is still something I'd like to add in the future.