Skip to content

Commit

Permalink
Merge pull request #2 from Afischbacher/develop
Browse files Browse the repository at this point in the history
Updating ability to package NuGet
  • Loading branch information
Afischbacher authored Sep 30, 2021
2 parents 25082c7 + fc23b60 commit 86d4d1f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions Nhl.Api.Tests/Nhl.Api.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Nhl.Api.Domain\Nhl.Api.Domain.csproj" />
<ProjectReference Include="..\Nhl.Api\Nhl.Api.csproj" />
</ItemGroup>

Expand Down
22 changes: 19 additions & 3 deletions Nhl.Api/Nhl.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,31 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>nhl-api-logo-128px-128px.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<ProjectReference Include="..\Nhl.Api.Common\Nhl.Api.Common.csproj" PrivateAssets="All" />
<ProjectReference Include="..\Nhl.Api.Domain\Nhl.Api.Domain.csproj" PrivateAssets="All" />
</ItemGroup>

<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="BuildOnlySettings;ResolveReferences">
<ItemGroup>
<!-- Filter out unnecessary files -->
<_ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('PrivateAssets', 'All'))"/>
</ItemGroup>

<!-- Print batches for debug purposes -->
<Message Text="Batch for .nupkg: ReferenceCopyLocalPaths = @(_ReferenceCopyLocalPaths), ReferenceCopyLocalPaths.DestinationSubDirectory = %(_ReferenceCopyLocalPaths.DestinationSubDirectory) Filename = %(_ReferenceCopyLocalPaths.Filename) Extension = %(_ReferenceCopyLocalPaths.Extension)" Importance="High" Condition="'@(_ReferenceCopyLocalPaths)' != ''" />

<ItemGroup>
<!-- Add file to package with consideration of sub folder. If empty, the root folder is chosen. -->
<BuildOutputInPackage Include="@(_ReferenceCopyLocalPaths)" TargetPath="%(_ReferenceCopyLocalPaths.DestinationSubDirectory)"/>
</ItemGroup>
</Target>

<ItemGroup>
<ProjectReference Include="..\Nhl.Api.Common\Nhl.Api.Common.csproj" />
<ProjectReference Include="..\Nhl.Api.Domain\Nhl.Api.Domain.csproj" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 86d4d1f

Please sign in to comment.