Skip to content

Commit

Permalink
Update .csproj files for packaging and build improvements
Browse files Browse the repository at this point in the history
Update .csproj files to include IncludeProjectReferenceDlls target and suppress NU5131 warning.
Modify ProjectReference elements to include PrivateAssets="all".
Add ItemGroup to include ref folder in the package.
Add IncludeProjectReferenceDlls target to include project reference DLLs in build output.
  • Loading branch information
marcominerva committed Sep 23, 2024
1 parent 44c21be commit 56fbcfe
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/marcominerva/MinimalHelpers.git</RepositoryUrl>
<RepositoryBranch>master</RepositoryBranch>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeProjectReferenceDlls</TargetsForTfmSpecificBuildOutput>
<NoWarn>$(NoWarn);NU5131</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand All @@ -42,6 +44,17 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MinimalHelpers.Validation.Abstractions\MinimalHelpers.Validation.Abstractions.csproj" />
<ProjectReference Include="..\MinimalHelpers.Validation.Abstractions\MinimalHelpers.Validation.Abstractions.csproj" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<!-- Add a ref folder to the package which only exposes the library so that the referenced class library doesn't get exposed. -->
<None Include="$(TargetPath)" PackagePath="ref/$(TargetFramework)" Pack="true" Condition="'$(TargetFramework)' != ''" />
</ItemGroup>

<Target Name="IncludeProjectReferenceDlls" DependsOnTargets="BuildOnlySettings;ResolveReferences">
<ItemGroup>
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('PrivateAssets', 'All'))"/>
</ItemGroup>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/marcominerva/MinimalHelpers.git</RepositoryUrl>
<RepositoryBranch>master</RepositoryBranch>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
Expand Down
17 changes: 15 additions & 2 deletions src/MinimalHelpers.Validation/MinimalHelpers.Validation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/marcominerva/MinimalHelpers.git</RepositoryUrl>
<RepositoryBranch>master</RepositoryBranch>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeProjectReferenceDlls</TargetsForTfmSpecificBuildOutput>
<NoWarn>$(NoWarn);NU5131</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand All @@ -42,6 +44,17 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MinimalHelpers.Validation.Abstractions\MinimalHelpers.Validation.Abstractions.csproj" />
<ProjectReference Include="..\MinimalHelpers.Validation.Abstractions\MinimalHelpers.Validation.Abstractions.csproj" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<!-- Add a ref folder to the package which only exposes the library so that the referenced class library doesn't get exposed. -->
<None Include="$(TargetPath)" PackagePath="ref/$(TargetFramework)" Pack="true" Condition="'$(TargetFramework)' != ''" />
</ItemGroup>

<Target Name="IncludeProjectReferenceDlls" DependsOnTargets="BuildOnlySettings;ResolveReferences">
<ItemGroup>
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('PrivateAssets', 'All'))"/>
</ItemGroup>
</Target>
</Project>

0 comments on commit 56fbcfe

Please sign in to comment.