I've a dotnet solution which consists of many .NET Framework 4.8 class library projects. Some projects have other packages installed, like log4net, Oracle.ManagedDataAccess, GraphQL.Client. In this solution file, I've a base NET Framework 4.8 class library project to which I've added all the other class libraries as dependencies.
Now I use azurepipelines.yml to build the whole solution and pack the base project and push it as nuget package. Now my nuget package has all the dlls plus it has dlls of log4net and other nuget packages that I installed to my projects. So the size of this package is very big. Instead of that, I want only my project dlls along with Microsoft dlls, and not the third party packages in my nuget package. And when I install this nuget package in my other solutions, I want the other libraries (log4net, Oracle.ManagedDataAccess, GraphQL.Client) to be installed along with that - to the "packages" folder.
This will help me to have a small nuget package and these extra library dlls will be installed separately. How can I do this?
- task: DotNetCoreCLI@2 displayName: 'Dotnet Pack' inputs: command: 'pack' arguments: '--configuration $(buildConfiguration)' packagesToPack: '**/MyBaseProject.csproj' versioningScheme: 'off' includeReferencedProjects: true- task: NuGetCommand@2 displayName: 'NuGet Push' inputs: command: 'push' feedsToUse: 'select' packagesToPush: '$(Build.ArtifactStagingDirectory)/**/XX*.nupkg' versioningScheme: 'off' allowPackageConflicts: true publishVstsFeed: 'feedIDHere'
My csproj is like below
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>net48</TargetFramework><PackageId>MyPackage</PackageId><Version>1.1.10</Version></PropertyGroup><ItemGroup><ProjectReference Include="..\Business\xx1.csproj"><ExcludeAssets>all</ExcludeAssets></ProjectReference></ProjectReference><ProjectReference Include="..\Logging\xx2.csproj"><ExcludeAssets>all</ExcludeAssets></ProjectReference></ProjectReference><ProjectReference Include="..\Services\xx3.csproj"><ExcludeAssets>all</ExcludeAssets></ProjectReference></ProjectReference></ItemGroup><ItemGroup><None Include="..\Business\bin\$(Configuration)\*.dll"><PackagePath>lib\net48</PackagePath><Pack>true</Pack><Visible>false</Visible></None></ItemGroup></Project>