Created
March 23, 2020 11:31
-
-
Save dtwk2/f873387222085f24c84ce249dcd4a499 to your computer and use it in GitHub Desktop.
How to use private project references in nuget package from https://github.com/NuGet/Home/issues/3891
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<TargetFrameworks>netstandard2.0;net47</TargetFrameworks> | |
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput> | |
</PropertyGroup> | |
<ItemGroup> | |
<ProjectReference Include="..\ClassLibrary2\ClassLibrary2.csproj" PrivateAssets="all" /> | |
<ProjectReference Include="..\ClassLibrary3\ClassLibrary3.csproj" Condition="'$(TargetFramework)' == 'net47'" PrivateAssets="all" /> | |
</ItemGroup> | |
<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="ResolveReferences"> | |
<ItemGroup> | |
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))" /> | |
</ItemGroup> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alos this package will bundle private projects with nuget package
Teronis.MSBuild.Packaging.ProjectBuildInPackage