Skip to content

Commit

Permalink
Move generation of SuggestedBindingRedirects.targets to inner build (d…
Browse files Browse the repository at this point in the history
…otnet#112379)

* Move generation of SuggestedBindingRedirects.targets to inner build

These targets depend on the AssemblyVersion of the library which is
specific to the inner-build of the library.  Generate them in the inner-build.

* Update src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj
  • Loading branch information
ericstj committed Feb 12, 2025
1 parent bf8ffdf commit 0453e8f
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
<IsPackable>true</IsPackable>
<SuggestedBindingRedirectsPackageFile>$(BaseIntermediateOutputPath)SuggestedBindingRedirects.targets</SuggestedBindingRedirectsPackageFile>
<BeforePack>$(BeforePack);GeneratePackageTargetsFile</BeforePack>
<PackageDescription>Provides classes which read and write resources in a format that supports non-primitive objects.

Commonly Used Types:
Expand Down Expand Up @@ -41,7 +40,7 @@ System.Resources.Extensions.PreserializedResourceWriter</PackageDescription>
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\RequiresUnreferencedCodeAttribute.cs"
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\RequiresUnreferencedCodeAttribute.cs"
Link="System\Diagnostics\CodeAnalysis\RequiresUnreferencedCodeAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs"
Link="System\Diagnostics\CodeAnalysis\UnconditionalSuppressMessageAttribute.cs" />
Expand All @@ -51,10 +50,11 @@ System.Resources.Extensions.PreserializedResourceWriter</PackageDescription>
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
</ItemGroup>

<Target Name="GeneratePackageTargetsFile"
<Target Name="GeneratePackageTargetsFile"
Inputs="$(MSBuildAllProjects)"
Outputs="$(SuggestedBindingRedirectsPackageFile)"
Condition="'$(NetFrameworkMinimum)' != ''">
AfterTargets="CoreCompile"
Condition="'$(TargetFramework)' == '$(NetFrameworkMinimum)'">
<PropertyGroup>
<SuggestedBindingRedirectsPackageFileContent><![CDATA[<Project>
<!-- ResolveAssemblyReferences will never see the assembly reference embedded in the resources type,
Expand All @@ -71,9 +71,11 @@ System.Resources.Extensions.PreserializedResourceWriter</PackageDescription>
Lines="$(SuggestedBindingRedirectsPackageFileContent)"
Overwrite="true" />

<ItemGroup>
<Content Include="$(SuggestedBindingRedirectsPackageFile)"
PackagePath="buildTransitive\$(NetFrameworkMinimum)\$(PackageId).targets" />
</ItemGroup>
</Target>

<ItemGroup Condition="'$(NetFrameworkMinimum)' != ''">
<None Include="$(SuggestedBindingRedirectsPackageFile)" Pack="true"
PackagePath="buildTransitive\$(NetFrameworkMinimum)\$(PackageId).targets" />
</ItemGroup>

</Project>

0 comments on commit 0453e8f

Please sign in to comment.