diff --git a/test/Utilities/Microsoft.Testing.TestInfrastructure/AcceptanceSourceGen.cs b/test/Utilities/Microsoft.Testing.TestInfrastructure/AcceptanceSourceGen.cs index 0b1a4a54ce..a63758c2bb 100644 --- a/test/Utilities/Microsoft.Testing.TestInfrastructure/AcceptanceSourceGen.cs +++ b/test/Utilities/Microsoft.Testing.TestInfrastructure/AcceptanceSourceGen.cs @@ -122,8 +122,17 @@ private static string BuildPropsContent(string packageId, string versionProperty MicrosoftTestingPlatformEntryPoint, SelfRegisteredExtensions) be double-compiled into this build. Re-exclude them here. This runs in CustomBeforeMicrosoftCommonProps (before the SDK seeds DefaultItemExcludes), so the SDK appends its own excludes after ours. + + The nested '**/obj/**;**/bin/**' globs matter for multi-project assets. The reflection build (which + always runs first, into the default bin/Release) leaves a referenced project's outputs on disk, e.g. + 'SomeRef/bin/Release//*.dll'. When this (later) source-gen build evaluates the host project, the + SDK's default item globs would otherwise pull those stray DLLs in as None/Content items, and RAR then + treats a wrong-TFM copy (for example a net10.0 'MSTest.TestFramework.Extensions.dll', assembly version + 9.0.0.0) as a candidate for the net8.0 leg -> MSB3277, which MSBuildTreatWarningsAsErrors promotes to an + error. The root-level 'bin/**;obj/**' does not match the nested 'SomeRef/bin/**', so exclude nested + bin/obj as well to keep a referenced project's leftover reflection outputs out of this build's globs. --> - $(DefaultItemExcludes);obj/**;bin/** + $(DefaultItemExcludes);obj/**;bin/**;**/obj/**;**/bin/**