Skip to content

Commit

Permalink
Fix Item update in Pack logic due to MSBuild regression
Browse files Browse the repository at this point in the history
- MSBuild Item update logic within target broke during 17.3-17.4!

  Previous logic referencing direct Item names worked fine before,
  but now needs a proxy/temporary item in order to process the includes.
  Same with the undefined Metadata, previously it returned empty string for
  items with the metadata undefined but now throws error. This may be correct
  behavior for items under target but this difference hinders sharing logic
  within and out of targets. This has a side-effect of needing to specify
  fully qualified name "%(Item.Metadata)" which makes it verbose.
  • Loading branch information
Nirmal4G committed Jan 14, 2023
1 parent 5d893b8 commit 849cc27
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions eng/Toolkit.GetBuildOutputs.targets
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
<BuildOutputPerTarget Update="@(BuildOutputPerTarget)" TargetFramework="$(TargetFramework)" />
</ItemGroup>

<ItemGroup Condition="'$(IsCompilerTargeting)' == 'true'">
<BuildOutputPerTarget Update="@(BuildOutputPerTarget)" IsCompilerExtension="true" />
<ItemGroup>
<BuildOutputPerTarget Update="@(BuildOutputPerTarget)" TargetCompiler="$(TargetCompiler)" />
<BuildOutputPerTarget Update="@(BuildOutputPerTarget)" TargetLanguage="$(TargetLanguage)" />
<BuildOutputPerTarget Update="@(BuildOutputPerTarget)" IsCompilerExtension="$(IsCompilerTargeting)" />
</ItemGroup>
</Target>

Expand Down
8 changes: 5 additions & 3 deletions eng/Toolkit.Packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@

<!-- Include the Build Outputs (also for each Custom target, like Roslyn analyzers and generators) in the package -->
<ItemGroup>
<PackageFile Include="@(NonReferencingProjectBuildOutput)">
<_NonReferencingProjectPackageFile Include="@(NonReferencingProjectBuildOutput->ClearMetadata())">
<TargetPath Condition="'%(IsCompilerExtension)' == 'true'">$([System.IO.Path]::Combine('analyzers', 'dotnet', '%(TargetCompiler)', '%(TargetLanguage)'))</TargetPath>
<TargetPath Condition="'%(TargetPath)' == ''">$([System.IO.Path]::Combine('tools', '%(TargetFramework)'))</TargetPath>
</PackageFile>
<TargetPath Condition="'%(IsCompilerExtension)' != 'true'">$([System.IO.Path]::Combine('tools', '%(TargetFramework)'))</TargetPath>
</_NonReferencingProjectPackageFile>
<PackageFile Include="@(_NonReferencingProjectPackageFile)" />
<_NonReferencingProjectPackageFile Remove="@(_NonReferencingProjectPackageFile)" />
</ItemGroup>
</Target>

Expand Down

0 comments on commit 849cc27

Please sign in to comment.