Skip to content
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

Dynamically Pack MVVM SourceGen project outputs #220

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
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.
  • Loading branch information
Nirmal4G committed Jan 17, 2023
commit 9b508f8bc2f708dc453e9177fcacc34683432091
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