Skip to content

Commit 849cc27

Browse files
committed
Fix Item update in Pack logic due to MSBuild regression
- 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.
1 parent 5d893b8 commit 849cc27

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

eng/Toolkit.GetBuildOutputs.targets

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
<BuildOutputPerTarget Update="@(BuildOutputPerTarget)" TargetFramework="$(TargetFramework)" />
2929
</ItemGroup>
3030

31-
<ItemGroup Condition="'$(IsCompilerTargeting)' == 'true'">
32-
<BuildOutputPerTarget Update="@(BuildOutputPerTarget)" IsCompilerExtension="true" />
31+
<ItemGroup>
3332
<BuildOutputPerTarget Update="@(BuildOutputPerTarget)" TargetCompiler="$(TargetCompiler)" />
3433
<BuildOutputPerTarget Update="@(BuildOutputPerTarget)" TargetLanguage="$(TargetLanguage)" />
34+
<BuildOutputPerTarget Update="@(BuildOutputPerTarget)" IsCompilerExtension="$(IsCompilerTargeting)" />
3535
</ItemGroup>
3636
</Target>
3737

eng/Toolkit.Packaging.targets

+5-3
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@
7878

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

0 commit comments

Comments
 (0)