Skip to content

Project references support #15

Description

@valchetski

I've tried to use your library as suggested in RicoSuter/NJsonSchema#1726.
At first, amazing library 🙂. It works like a charm for transient NuGet packages.
However, I have one question and one issue with project references

Question

Does it support the automatic inclusion of referenced projects (also transient references) DLLs into the NuGet package?
For example, is it possible to avoid these lines and have these DLLs included automatically?

<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\NJsonSchema.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\NJsonSchema.Annotations.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\NJsonSchema.CodeGeneration.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\NJsonSchema.CodeGeneration.CSharp.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />

And avoid these for the case when Source Generator is used as project reference itself:

<PropertyGroup>
  <GetTargetPathDependsOn>
      $(GetTargetPathDependsOn);GetDependencyTargetPaths
  </GetTargetPathDependsOn>
</PropertyGroup>

<Target Name="GetDependencyTargetPaths">
  <ItemGroup>
      <TargetPathWithTargetPlatformMoniker Include="$(OutputPath)\NJsonSchema.dll" IncludeRuntimeDependency="false" />
      <TargetPathWithTargetPlatformMoniker Include="$(OutputPath)\NJsonSchema.Annotations.dll" IncludeRuntimeDependency="false" />
      <TargetPathWithTargetPlatformMoniker Include="$(OutputPath)\NJsonSchema.CodeGeneration.dll" IncludeRuntimeDependency="false" />
      <TargetPathWithTargetPlatformMoniker Include="$(OutputPath)\NJsonSchema.CodeGeneration.CSharp.dll" IncludeRuntimeDependency="false" />
  </ItemGroup>
</Target>

Issue

It appears that it somehow treats all project references as dependent NuGet packages.

Try to generate a NuGet package for the NJsonSchema.SourceGenerators.CSharp project from https://github.com/valchetski/NJsonSchema/tree/source-generator-h-generators
Then try to install it and see that it gonna install all the packages.
image

This is something I would like to disable. Or at least have it configurable.

If you do the same from https://github.com/valchetski/NJsonSchema/tree/source-generator branch (H.Generators.Extensions library is not installed there) then it'll install the bare minimum which is what I need:
image
Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions