|
299 | 299 | <!-- |
300 | 300 | The net472 servicing redistribution above swaps DLLs and updates the binding redirects only in |
301 | 301 | the projects that opt in ($(DeployRuntimeServicingAssemblies) == 'true': MSBuild.exe and the |
302 | | - bootstrap). Other net472 projects that re-bundle MSBuild.exe (the test projects that spawn it |
303 | | - out-of-proc, e.g. via ProjectReference to MSBuild.csproj) copy MSBuild.exe.config (which now |
304 | | - carries the servicing redirects) but resolve their own copy-local runtime assemblies at the |
305 | | - compiled-against versions. That leaves MSBuild.exe.config pointing at servicing versions |
306 | | - (e.g. System.Memory 4.0.5.0) while the assembly on disk is the compiled-against one |
307 | | - (4.0.2.0), so the copied MSBuild.exe fails to start with a FileLoadException, breaking every |
308 | | - out-of-proc test (and hanging tests that wait on a spawned node/server). |
309 | | -
|
310 | | - These bins are not a VS redistribution surface, so the fix is to keep them self-consistent at |
311 | | - the compiled-against versions: realign the copied MSBuild.exe.config binding redirects to the |
312 | | - runtime assemblies actually next to it. Deploy surfaces are excluded; their DLLs already are |
313 | | - the servicing build, so realigning would be a no-op there anyway. |
| 302 | + bootstrap). Test projects that re-bundle MSBuild.exe (they spawn it out-of-proc, e.g. via |
| 303 | + ProjectReference to MSBuild.csproj) copy MSBuild.exe.config (which now carries the servicing |
| 304 | + redirects) but resolve their own copy-local runtime assemblies at the compiled-against |
| 305 | + versions. That leaves MSBuild.exe.config pointing at servicing versions (e.g. System.Memory |
| 306 | + 4.0.5.0) while the assembly on disk is the compiled-against one (4.0.2.0), so the copied |
| 307 | + MSBuild.exe fails to start with a FileLoadException, breaking every out-of-proc test (and |
| 308 | + hanging tests that wait on a spawned node/server). |
| 309 | +
|
| 310 | + These test bins are not a VS redistribution surface, so the fix is to keep them self-consistent |
| 311 | + at the compiled-against versions: realign the copied MSBuild.exe.config binding redirects to the |
| 312 | + runtime assemblies actually next to it. |
| 313 | +
|
| 314 | + This is scoped to test projects only ($(RealignBundledMSBuildExeConfig), defaulted on for |
| 315 | + $(IsTestProject) == 'true') and deliberately NOT keyed on the absence of |
| 316 | + $(DeployRuntimeServicingAssemblies): non-test projects that bundle MSBuild.exe for shipping |
| 317 | + (e.g. the VS.ExternalAPIs.MSBuild insertion package) must never have their copied config |
| 318 | + rewritten to the compiled-against versions, even though they happen not to ship MSBuild.exe.config |
| 319 | + today. |
314 | 320 | --> |
| 321 | + <PropertyGroup> |
| 322 | + <RealignBundledMSBuildExeConfig Condition="'$(RealignBundledMSBuildExeConfig)' == '' and '$(IsTestProject)' == 'true'">true</RealignBundledMSBuildExeConfig> |
| 323 | + </PropertyGroup> |
| 324 | + |
315 | 325 | <UsingTask TaskName="AlignBindingRedirectsToOutputAssemblies" |
316 | 326 | AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" |
317 | 327 | TaskFactory="RoslynCodeTaskFactory"> |
|
388 | 398 |
|
389 | 399 | <Target Name="AlignCopiedMSBuildExeConfigBindingRedirects" |
390 | 400 | AfterTargets="Build" |
391 | | - Condition="'$(TargetFramework)' == 'net472' and '$(DeployRuntimeServicingAssemblies)' != 'true'"> |
| 401 | + Condition="'$(TargetFramework)' == 'net472' and '$(RealignBundledMSBuildExeConfig)' == 'true'"> |
392 | 402 | <ItemGroup> |
393 | 403 | <_CopiedMSBuildExeConfig Include="$(TargetDir)**\MSBuild.exe.config" /> |
394 | 404 | </ItemGroup> |
|
0 commit comments