简体   繁体   中英

Integrated nuget, how to include dependant project into package

Let's consider project A and project B . I would like to publish project A as a nuget package without having to publish project B . In the old time I would use manually nuget ... A.csproj -IncludeReferencedProjects . Currently, when nuget is integrated with visual studio, it just interpret .csproj on build with some options like authors , tags etc... However it looks like there is no option to use IncludeReferencedProjects here. How would I use it? Is it possible to change default command that msbuild is running with and add this switch?

There is currently no official solution for having multiple projects in one nuget package, similar to IncludeReferencedProjects for "nuget pack".

But you can do:

1. Add 'PrivateAssets="all" to all 'ProjectReference' XmlElements.

2. Add ItemGroup to include DLL's:
  <ItemGroup>
    <Content Include="$(OutputPath)$(MSBuildProjectName).*.dll" Pack="true" PackagePath="lib/$(TargetFramework)" />
  </ItemGroup>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM