Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.
{
public string TargetAssetPath => GetAssetPath(AssetName);

public string BaseTargetAssetPath => GetAssetPath(BaseClassAssetName);

public override IEnumerable<(string ID, string Name, string Code)> GetAssetsToGenerate()
{
yield return (BaseClassAssetName, BaseClassAssetName,
BaseClassSourceCode.PatchTargetFrameworks(TargetFrameworks.All));

// NOTE: The BaseClass asset is embedded as a subdirectory within the main asset to avoid
// parallel build conflicts. If they were separate assets, TestAssetFixtureBase would build
// them in parallel, but TestDiscoveryWarnings has a ProjectReference to TestDiscoveryWarningsBaseClass,
// causing both builds to write to the same files simultaneously (file locking errors).
yield return (AssetName, AssetName,
SourceCode.PatchTargetFrameworks(TargetFrameworks.All)
.PatchCodeWithReplace("$MSTestVersion$", MSTestVersion));
Expand All @@ -75,7 +74,8 @@ public sealed class TestAssetFixture() : TestAssetFixtureBase(AcceptanceFixture.
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../TestDiscoveryWarningsBaseClass/TestDiscoveryWarningsBaseClass.csproj" />
<ProjectReference Include="TestDiscoveryWarningsBaseClass/TestDiscoveryWarningsBaseClass.csproj" />
<Compile Remove="TestDiscoveryWarningsBaseClass/**" />
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

<Compile Remove="TestDiscoveryWarningsBaseClass/**" /> uses a very broad glob that will enumerate all files under that subtree (including bin/obj once they exist) during MSBuild evaluation. Since the intent is only to prevent the main project from compiling the nested base-class sources, restrict the remove pattern to C# sources (e.g., **/*.cs) to avoid unnecessary filesystem scanning and accidental future removals if default items change.

Suggested change
<Compile Remove="TestDiscoveryWarningsBaseClass/**" />
<Compile Remove="TestDiscoveryWarningsBaseClass/**/*.cs" />

Copilot uses AI. Check for mistakes.
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="$MSTestVersion$" />
Expand Down Expand Up @@ -129,10 +129,8 @@ public class TestClass2
[TestMethod]
public void Test2_1() {}
}
""";

private const string BaseClassSourceCode = """
#file TestDiscoveryWarningsBaseClass.csproj
#file TestDiscoveryWarningsBaseClass/TestDiscoveryWarningsBaseClass.csproj
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
Expand All @@ -143,8 +141,7 @@ public void Test2_1() {}

</Project>


#file UnitTest1.cs
#file TestDiscoveryWarningsBaseClass/UnitTest1.cs
namespace Base;

public class BaseClass
Expand Down
Loading