Closed vsilvar closed 1 year ago
I would love to add this feature, but I'm not very familiar with this use-case or how it is done. I'll do some research and get back to you. If you can offer a pull request of an example of what I have to change to include the source in the NuGet package I would appreciate it.
From looking at the source code from Scriban, they do it with this condition:
<Project>
<ItemGroup Condition="'$(PackageScribanIncludeSource)' == 'true'">
<Compile Include="$(MSBuildThisFileDirectory)../src/**/*.cs" Visible="false"/>
</ItemGroup>
</Project>
It looks like a simple change. I think what I might do is create a new NuGet package that includes the sources unconditionally.
I created a new release, https://github.com/MarcosLopezC/LightJson/releases/tag/v0.5.1, which makes the NuGet package include the sources and symbols.
If this is what you need, please feel free to close the ticket. Otherwise, let me know what else I can do to help.
The new release doesn't quite address the issue, but I went ahead and created a PR.
For context, you can see the files that are actually included in the Scriban package: https://nuget.info/packages/Scriban/5.7.0 And that it wasn't the case with the new release: https://nuget.info/packages/MarcosLopezC.LightJson/0.5.1
@vsilvar I merged one of your pull requests and made a new release. Let me know if that was what you were looking for.
@MarcosLopezC Just tested the changes, and they are working great. Thanks!
Currently, due to roslyn limitations, it's rather cumbersome to use Json libraries in source generators. One approach, taken by https://github.com/DotNetAnalyzers/StyleCopAnalyzers was to copy over the code, and maintain it. But it would be extremely useful to, instead, either have the source code embedded in the current package, or release a dedicated source code package.
As an example, scriban, already does that: https://github.com/scriban/scriban#source-embedding
I think if that was implemented, it would make it a very nice package to use in source generators.