Skip to content

Conversation

@dougbu
Copy link
Contributor

@dougbu dougbu commented Sep 19, 2021

  • also, only update latest @(KnownFrameworkReference) items
    • previously the updates applied e.g. to all Microsoft.NETCore.App items

nit: expand @(KnownFrameworkReference) comments

- also, only update latest `@(KnownFrameworkReference)` items
  - previously the updates applied e.g. to all Microsoft.NETCore.App items

nit: expand `@(KnownFrameworkReference)` comments
@dougbu dougbu requested a review from a team September 19, 2021 00:02
@ghost ghost added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Sep 19, 2021
@dougbu
Copy link
Contributor Author

dougbu commented Sep 19, 2021

Issue noticed in Servicing Readiness Exercise

  • could e.g. mean we don't use latest source generators

dougbu added a commit that referenced this pull request Sep 19, 2021
- `<Copy />` task will create directories
- avoid leftover files from a previous build
- avoid confusing SDK with an empty targeting pack directory
  - prevented ASP.NET targeting pack download when not building it (see #36718)
<ItemGroup>
<!-- Use the same NETCore shared framework as repo built against except when building product code in servicing. -->
<KnownFrameworkReference
Update="@(KnownFrameworkReference->WithMetadataValue('Identity', 'Microsoft.NETCore.App')->WithMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}'))"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rainersigwald shouldn't this construct only update the item with the exact metadata described❔ I could swear I tested this out w/ earlier SDKs et cetera and saw it working correctly. Definitely updates all items named Microsoft.NETCore.App now.

My preference here would be to avoid repeating the '%(TargetFramework)' == '${DefaultNetCoreTargetFramework}' on all metadata updates.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I would have expected that to work. @benvillalobos can you take a look at this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I wait to merge this PR @benvillalobos @rainersigwald

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also would have expected this to work. I can dig into this tomorrow and get back to you. I wouldn't consider it a blocker unless you're worried about perf / potentially updating it again

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please find attached a sample Directory.Build.targets file after we've used the Directory.Build.targets.in template. The final file contains no curly braces.
    Directory.Build.targets.txt
  2. The @(KnownFrameworkReference) item group consists almost entirely of overlapping groups e.g. there are 4 TFM-specific entries for `Microsoft.NETCore.App:
    image
  3. When using ->WithMetadataValue('TargetFramework', '${DefaultNetCoreTargetFramework}')) (actually ->WithMetadataValue('TargetFramework', 'net6.0'))), the result was all four Microsoft.NETCore.App items were updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dougbu do you know what version of the sdk you saw this working prior?

I've filed an issue for it here: dotnet/msbuild#6880

Copy link
Contributor Author

@dougbu dougbu Sep 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched to use the double WithMetadataValue(...) in Update way back in 5fd1db2, December 2020. My old friend git switch --detach 5fd1db26257 showed me we were using the 6.0.100-alpha.1.20523.3 back then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my. I remember doing a lot of .binlog checking while working on that. But, I just changed the indentation of the relevant Directory.Build.targets.in bits. Looking back…

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced in 219ecd6, October 2020. SDK at that time was also 6.0.100-alpha.1.20523.3 (surprisingly)

Comment on lines -41 to -42
<TargetingPackVersion Condition=" '$(IsServicingBuild)' != 'true' AND
'$(TargetLatestDotNetRuntime)' != 'false' ">${MicrosoftNETCoreAppRefVersion}</TargetingPackVersion>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember the history of this Condition but it seems to do more harm than good these days. Same for the similar Condition in the next @(KnownFrameworkReference) update.

dougbu added a commit that referenced this pull request Sep 20, 2021
- `<Copy />` task (well, most tasks though not `tar` commands) will create directories
- avoid leftover files from a previous build
- avoid confusing SDK with an empty targeting pack directory
  - prevented ASP.NET targeting pack download when not building it (see #36718)
@dougbu dougbu merged commit e517d74 into main Sep 21, 2021
@dougbu dougbu deleted the dougbu/always.target branch September 21, 2021 04:09
@ghost ghost added this to the 7.0-preview1 milestone Sep 21, 2021
dougbu added a commit that referenced this pull request Sep 30, 2021
- backport of #36719

Clear layout directories before copies (#36719)

  - `<Copy />` task (well, most tasks though not `tar` commands) will create directories
  - avoid leftover files from a previous build
  - avoid confusing SDK with an empty targeting pack directory
    - prevented ASP.NET targeting pack download when not building it (see #36718)
dougbu added a commit that referenced this pull request Sep 30, 2021
- backport of #36718

Always use latest targeting packs (#36718)

  - also, only update latest `@(KnownFrameworkReference)` items
    - previously the updates applied e.g. to all Microsoft.NETCore.App items

  nit: expand `@(KnownFrameworkReference)` comments
dougbu added a commit that referenced this pull request Sep 30, 2021
- backport of #36718

Always use latest targeting packs (#36718)

  - also, only update latest `@(KnownFrameworkReference)` items
    - previously the updates applied e.g. to all Microsoft.NETCore.App items

  nit: expand `@(KnownFrameworkReference)` comments
dougbu added a commit that referenced this pull request Sep 30, 2021
- backport of #36719

Clear layout directories before copies (#36719)

  - `<Copy />` task (well, most tasks though not `tar` commands) will create directories
  - avoid leftover files from a previous build
  - avoid confusing SDK with an empty targeting pack directory
    - prevented ASP.NET targeting pack download when not building it (see #36718)
dougbu added a commit that referenced this pull request Oct 1, 2021
- backport of #36719

Clear layout directories before copies (#36719)

  - `<Copy />` task (well, most tasks though not `tar` commands) will create directories
  - avoid leftover files from a previous build
  - avoid confusing SDK with an empty targeting pack directory
    - prevented ASP.NET targeting pack download when not building it (see #36718)
dougbu added a commit that referenced this pull request Oct 5, 2021
- backport of #36719

Clear layout directories before copies (#36719)

  - `<Copy />` task (well, most tasks though not `tar` commands) will create directories
  - avoid leftover files from a previous build
  - avoid confusing SDK with an empty targeting pack directory
    - prevented ASP.NET targeting pack download when not building it (see #36718)
dougbu added a commit that referenced this pull request Oct 5, 2021
- backport of #36719

Clear layout directories before copies (#36719)

  - `<Copy />` task (well, most tasks though not `tar` commands) will create directories
  - avoid leftover files from a previous build
  - avoid confusing SDK with an empty targeting pack directory
    - prevented ASP.NET targeting pack download when not building it (see #36718)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants