0

I'm working on a plugin-based app where external DLL's are being loaded dynamically. My goal is to create a Nuget package which defines a set of interfaces to be used by the plugins, in the form of a reference assembly (without implementation details).

The problem is, that the project I have to pack (let's call it ProjectA) as a Nuget is within a huge solution and has a reference on an another project (ProjectB). ProjectA contains the interfaces and method calls to ProjectB which is doing the actual business logic. My idea is to have the plugin loaded into the memory, and during runtime the actual implementation of ProjectA will do the job.

ProjectA's project file looks like this:

<Project Sdk="Microsoft.NET.Sdk">
     <PropertyGroup>
          <IsPackable>true</IsPackable>
          <GeneratePackageOnBuild>true</GeneratePackageOnBuild> 
          <ProduceReferenceAssembly>true</ProduceReferenceAssembly> 
          <ProduceReferenceAssemblyInOutDir>true</ProduceReferenceAssemblyInOutDir>
          <Deterministic>true</Deterministic>
          <VersionPrefix>1.0.6</VersionPrefix>
     </PropertyGroup>

     <ItemGroup>
          <ProjectReference Include="ProjectB.csproj" />
     </ItemGroup>
</Project>

When I'm pushing the generated Nuget package from the bin folder, the Nuget server shows that the package has a dependency on ProjectB and when the third-party project (ProjectX) tries to restore it, an error Unable to find package ProjectB. is being thrown which makes sense, because ProjectB is not a Nuget package.

ProjectX's project file:

...
    <ItemGroup>
        <PackageReference Include="ProjectA" Version="1.0.6" />
    </ItemGroup>
...

Question: How to publish ProjectA as a Nuget package properly while having an internal dependency which should be hidden from the plugins?

  • seems like you want to include dependencies on your nuget package, does this help: https://stackoverflow.com/questions/40396161/include-all-dependencies-using-dotnet-pack – Florent Bunjaku Apr 12 '23 at 10:13

0 Answers0