When I try to use the built-in feature of creating Nuget packages in VS 2017 (for a .NET Standard class library), it doesn't include any dependencies (project references), it includes only the DLL of the current project...
Here is my project file:
<Project Sdk="Microsoft.NET.Sdk">
.
.
<PropertyGroup>
<TargetFrameworks>netstandard1.6;net47</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncludeBuildOutput>True</IncludeBuildOutput>
<IncludeContentInPack>True</IncludeContentInPack>
<DevelopmentDependency>False</DevelopmentDependency>
</PropertyGroup>
.
.
</Project>
I tried different values for: DevelopmentDependency, IncludeContentInPack, IncludeBuildOutput, and it is the same.
I tried also on VS 2017 preview release as well.
You must use the
IncludeReferencedProjects
switch with the NuGet pack command.So, do something like:
Find the complete NuGet CLI here
Although NuGet picks up certain info about the package automatically(Assembly info as well as the output dll paths), anything that deals with packaging must be dealt with by either using the flags, or by creating a custom .NuSpec file.
Hope this helps!
I aware of you want to pack nuget package include the referenced projects by Visual Studio 2017 directly. But I found that VS 2017 take the project references as dependencies when you pack package by VS 2017, I have not found a values to pack package include the referenced project as DLL file by VS directly.
As a workaround, you can use nuget and .nuspec file to include the referenced project, below is my .nupsec file:
Then use the command:
nuget pack .nuspec
to create the nuget package.For the detail info, you can refer to the Create .NET standard packages.