Skip to content

Commit 3e1c6e6

Browse files
committed
fix: include AngleSharpWrappers.dll in bunit.web.nupkg
1 parent 4904a55 commit 3e1c6e6

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

src/bunit.web/bunit.web.csproj

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,30 @@
4949
</ItemGroup>
5050

5151
<ItemGroup>
52-
<ProjectReference Include="..\AngleSharpWrappers\AngleSharpWrappers.csproj" />
52+
<ProjectReference Include="..\AngleSharpWrappers\AngleSharpWrappers.csproj" PrivateAssets="All" />
5353
<ProjectReference Include="..\bunit.core\bunit.core.csproj" />
5454
</ItemGroup>
5555

56+
<!-- The following two elements ensures that AngleSharpWrappers.dll is included in this projects nuget package -->
57+
<PropertyGroup>
58+
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
59+
</PropertyGroup>
60+
61+
<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="BuildOnlySettings;ResolveReferences">
62+
<ItemGroup>
63+
<!-- Filter out unnecessary files -->
64+
<_ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('PrivateAssets', 'All'))"/>
65+
</ItemGroup>
66+
67+
<!-- Print batches for debug purposes -->
68+
<Message Text="Batch for .nupkg: ReferenceCopyLocalPaths = @(_ReferenceCopyLocalPaths), ReferenceCopyLocalPaths.DestinationSubDirectory = %(_ReferenceCopyLocalPaths.DestinationSubDirectory) Filename = %(_ReferenceCopyLocalPaths.Filename) Extension = %(_ReferenceCopyLocalPaths.Extension)" Importance="High" Condition="'@(_ReferenceCopyLocalPaths)' != ''" />
69+
70+
<ItemGroup>
71+
<!-- Add file to package with consideration of sub folder. If empty, the root folder is chosen. -->
72+
<BuildOutputInPackage Include="@(_ReferenceCopyLocalPaths)" TargetPath="%(_ReferenceCopyLocalPaths.DestinationSubDirectory)"/>
73+
</ItemGroup>
74+
</Target>
75+
5676
<ItemGroup Label="Implicit usings" Condition="$(MSBuildProjectName) != 'bunit.template' AND $(MSBuildProjectName) != 'bunit'">
5777
<Using Include="Microsoft.AspNetCore.Components.Web" />
5878
<Using Include="Microsoft.JSInterop" />

0 commit comments

Comments
 (0)