-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only add placeholder pkg file if folder is empty #67647
Only add placeholder pkg file if folder is empty #67647
Conversation
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsFixes #63413 Placeholder files are added unconditionally by the .NETStandard compat That hinders our libraries to package their own set of buildTransitive This change makes sure that placeholder files are added only if no None Adding documentation that explains the .NETStandard compatibility
|
No objections from me. I was going to do it after your change. But if you want to take it here, that's totally fine with me. |
09ac364
to
2bfcb48
Compare
@eerhardt the change is ready to be reviewed. |
BeforePack must be used. Setting both to ensure that we are always running before other targets. --> | ||
<PackDependsOn>AddNETStandardCompatErrorFileForPackaging;IncludeAnalyzersInPackage;$(PackDependsOn)</PackDependsOn> | ||
<BeforePack>AddNETStandardCompatErrorFileForPackaging;IncludeAnalyzersInPackage;$(BeforePack)</BeforePack> | ||
<BeforePack>$(BeforePack);IncludeAnalyzersInPackage;AddNETStandardCompatErrorFileForPackaging</BeforePack> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PackDependsOn doesn't work anymore with the sequencing that we depend on. The BeforePack hook is fine as we don't rely on NuGet.Build.Tasks.Pack
as an OOB nuget package anymore.
2bfcb48
to
4d69282
Compare
<ItemGroup> | ||
<None Include="$(PlaceholderFile)" | ||
Pack="true" | ||
PackagePath="$(BuildOutputTargetFolder)\$(NetFrameworkMinimum)\" | ||
Condition="'$(AddNETFrameworkPlaceholderFileToPackage)' == 'true'" /> | ||
<None Include="$(PlaceholderFile)" | ||
Pack="true" | ||
PackagePath="$(BuildOutputTargetFolder)\MonoAndroid10\; | ||
$(BuildOutputTargetFolder)\MonoTouch10\; | ||
$(BuildOutputTargetFolder)\xamarinios10\; | ||
$(BuildOutputTargetFolder)\xamarinmac20\; | ||
$(BuildOutputTargetFolder)\xamarintvos10\; | ||
$(BuildOutputTargetFolder)\xamarinwatchos10\" | ||
Condition="'$(AddXamarinPlaceholderFilesToPackage)' == 'true'" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's just clean-up to avoid multiple items.
<!-- Include a netstandard compat error if the project targets both .NETStandard and | ||
.NETCoreApp. This prohibits users to consume packages on an older .NETCoreApp version | ||
than the minimum supported one. --> | ||
<ItemGroup> | ||
<NETStandardCompatError Include="netcoreapp2.0" | ||
Supported="$(NetCoreAppMinimum)" | ||
Condition="$(TargetFrameworks.Contains('netstandard2.')) and | ||
($(TargetFrameworks.Contains('$(NetCoreAppMinimum)')) or $(TargetFrameworks.Contains('$(NetCoreAppCurrent)')))" /> | ||
<NETStandardCompatError Include="net461" | ||
Supported="$(NetFrameworkMinimum)" | ||
Condition="$(TargetFrameworks.Contains('netstandard2.0')) and | ||
($(TargetFrameworks.Contains('$(NetFrameworkMinimum)')) or $(TargetFrameworks.Contains('net47')) or $(TargetFrameworks.Contains('net48')))" /> | ||
</ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block was moved up without any changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like
'$(DisableNETStandardCompatErrorForNETCoreApp)' != 'true'" />
was removed in the move.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, those two items are now always defined but there is a new switch to disable the NETStandard compat errors. (which isn't used anywhere but it's good to have it)
Originally reported in dotnet#63413, placeholder files are added unconditionally by the .NETStandard compat error packaging infrastructure, even if the buildTransitive/$(SupportedTFM) folder isn't empty. That hinders our libraries to package their own set of buildTransitive props and targets files for the supported set of tfms. This change makes sure that placeholder files are added only if no None or Content items are declared that point to the same package folder. Adding documentation that explains the .NETStandard compatibility packaging infrasturcture and how to correctly package hand-authored msbuild files next to the generated targets files.
4d69282
to
4398a31
Compare
src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments. Nothing major.
@ViktorHofer, fyi, codeflow is hitting the following error, probably related to this change (diff: 5707668...f2ce5e8):
(error message itself seems erroneous since net7.0 > net6.0 🤔) |
Just noticed that |
That <Project InitialTargets="NETStandardCompatError_System_Text_Encodings_Web_net462">
<Target Name="NETStandardCompatError_System_Text_Encodings_Web_net462"
Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">
<Error Text="System.Text.Encodings.Web doesn't support $(TargetFramework). Consider updating your TargetFramework to net462 or later." />
</Target>
</Project> |
Oh thanks... Will submit a fix asap |
Fixes #63413
Fixes #60870
Placeholder files are added unconditionally by the .NETStandard compat
error packaging infrastructure, even if the
buildTransitive/$(SupportedTFM) package folder isn't empty.
That hinders our libraries to package their own set of buildTransitive
props and targets files for the supported set of tfms.
This change makes sure that placeholder files are added only if no None
or Content items are declared that point to the same package folder.
Adding documentation that explains the .NETStandard compatibility
packaging infrasturcture and how to correctly package hand-authored
msbuild files next to the generated targets files.