Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

dotnet pack include multiple projects into single NuGet package

$
0
0

I have 3 dotnet projects under a solution A,B and C. Project A have ProjectReference in csproj file to B and C. B and C have multiple Package references to publicly available packages in their respective csproj files.

example of A.csproj

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFrameworks>net6.0;net8.0</TargetFrameworks><Version>1.0.0</Version></PropertyGroup><ItemGroup><PackageReference Include="OpenTelemetry" Version="1.3.2" /><PackageReference Include="OpenTelemetry.Api" Version="1.3.2" /></ItemGroup><ItemGroup><ProjectReference Include="..\B\B.csproj" /><ProjectReference Include="..\C\C.csproj" /></ItemGroup></Project>

example of B.csporj

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFrameworks>net6.0;net8.0</TargetFrameworks><Version>1.0.0</Version><IsPackable>false</IsPackable></PropertyGroup><ItemGroup><PackageReference Include="Google.Protobuf" Version="3.25.1" /></ItemGroup></Project>

When I tried dotnet pack simply, on installation of A.nupkg, it complained that B and C are not available. Tried this answer: https://stackoverflow.com/a/73043707/12694936, now the B and C dlls were bundled, but the dependencies of B and C were not installed. Is there any way I can make it work so that I dont have to publish B.nupkg and C.nupkg to some NuGet repository?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>