Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Traversal] Filtering projects solution files without kicking off evaluations

オープン
#522 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
48/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp
領域
build-system

調査の方向性

Directory.Solution.targets と Microsoft.Build.Traversal Sdk.targets の実装を確認し、通常の restore の動作と issue 521 で説明されている静的グラフの制限を比較します。評価前にプロジェクトをフィルターするための GetProjectsToSkip override を、現在は通常の restore にのみ適用されることも含めて文書化します。

索引モデルが issue の本文から書いたものです。

説明

The new filter projects in solution files feature in Microsoft.Build.Traversal is phenomenal. I noticed that by default, it still kicks off evaluations for the projects in order to then invoke the custom ShouldSkipProject target. In my situation, I don't want to even trigger evaluations (and with also not trigger msbuild sdk resolver events). I was able to make that work with the following code:

Directory.Solution.targets

<Project>

  <Import Sdk="Microsoft.Build.Traversal" Project="Sdk.targets" />

  <!-- Overwrite target from Traversal Sdk.targets. -->
  <Target Name="GetProjectsToSkip">
    <ItemGroup>
      <ProjectToSkip Include="@(ProjectReference)"
                     Message=""
                     Condition="$([System.String]::new('%(ProjectReference.Identity)').EndsWith('.Tests.csproj'))"
                     OriginalItemSpec="%(Identity)" />
    </ItemGroup>
  </Target>

</Project>

Unfortunately this only works with normal restore and not static graph based restore: https://github.com/microsoft/MSBuildSdks/issues/521

Should we document this option? From my perspective, while this is a static mechanism to filter out projects, it's the only correct way as it doesn't even trigger evaluations of filtered out projects.

主要言語
C#
スター
513
フォーク
94
平均マージ
49分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/MSBuildSdks のほかの issue

microsoft/MSBuildSdks の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。