Skip to content

Commit 185ba8e

Browse files
committed
Mostly fixed, just a couple more issues
1 parent 562d99c commit 185ba8e

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/ProjectTemplates/TestInfrastructure/PrepareForTest.targets

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<PropertyGroup>
2727
<TestTemplateCreationFolder>$([MSBuild]::NormalizePath('$(OutputPath)$(TestTemplateCreationFolder)'))</TestTemplateCreationFolder>
2828
<CustomTemplateHivePath>$(TestTemplateCreationFolder)\Hives\$([System.Guid]::NewGuid())\.templateengine</CustomTemplateHivePath>
29+
<TemplateTestDotNetRoot>$(TestTemplateCreationFolder)\dotnet\</TemplateTestDotNetRoot>
2930
</PropertyGroup>
3031

3132
<ItemGroup>
@@ -48,10 +49,16 @@
4849
<_Parameter1>TestTemplateCreationFolder</_Parameter1>
4950
<_Parameter2>$(TestTemplateCreationFolder)</_Parameter2>
5051
</AssemblyAttribute>
52+
5153
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
5254
<_Parameter1>CustomTemplateHivePath</_Parameter1>
5355
<_Parameter2>$(CustomTemplateHivePath)</_Parameter2>
5456
</AssemblyAttribute>
57+
58+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
59+
<_Parameter1>DotNetExeOverride</_Parameter1>
60+
<_Parameter2>$(TemplateTestDotNetRoot)dotnet.exe</_Parameter2>
61+
</AssemblyAttribute>
5562
</ItemGroup>
5663

5764
<Message Importance="high" Text="Preparing environment for tests" />
@@ -61,6 +68,7 @@
6168

6269
<ItemGroup>
6370
<_ExistingFilesFromLastRun Include="$(TestTemplateCreationFolder)**\*" />
71+
<!-- <_ExistingFilesFromLastRun Include="$(TemplateTestDotNetRoot)**\*" /> -->
6472
</ItemGroup>
6573

6674
<Delete Files="@(_ExistingFilesFromLastRun)" ContinueOnError="true" />
@@ -72,6 +80,20 @@
7280
<Output TaskParameter="RemovedDirectories" ItemName="_CleanedUpDirectories" />
7381
</RemoveDir>
7482

83+
<ItemGroup>
84+
<_FilesToCopy Include="$(LocalDotNetRoot)dotnet.exe" />
85+
<_FilesToCopy Include="$(LocalDotNetRoot)host\**\*" DestinationRelativeFolder="host\" />
86+
<_FilesToCopy Include="$(LocalDotNetRoot)shared\**\*" DestinationRelativeFolder="shared\" />
87+
<_FilesToCopy Include="$(LocalDotNetRoot)sdk\**\*" DestinationRelativeFolder="sdk\" />
88+
<_FilesToCopy Include="$(SharedFrameworkLayoutRoot)\**\*" />
89+
90+
<_DestinationFiles Include="@(_FilesToCopy->'$(TemplateTestDotNetRoot)\%(DestinationRelativeFolder)%(RecursiveDir)%(Filename)%(Extension)')" />
91+
</ItemGroup>
92+
93+
<Copy SourceFiles="@(_FilesToCopy)"
94+
DestinationFiles="@(_DestinationFiles)"
95+
SkipUnchangedFiles="true" />
96+
7597
<Message Importance="high" Text="Removed directory %(_CleanedUpDirectories.Identity)" />
7698

7799
<Message Importance="high" Text="Created directory %(_CreatedDirectories.Identity)" />

src/Shared/CommandLineUtils/Utilities/DotNetMuxer.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System;
1010
using System.Diagnostics;
1111
using System.IO;
12+
using System.Reflection;
1213
using System.Runtime.InteropServices;
1314

1415
namespace Microsoft.Extensions.CommandLineUtils;
@@ -22,7 +23,9 @@ internal static class DotNetMuxer
2223

2324
static DotNetMuxer()
2425
{
25-
MuxerPath = TryFindMuxerPath();
26+
var dotNetRootOverride = typeof(DotNetMuxer).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
27+
.SingleOrDefault(a => a.Key == "DotNetExeOverride")?.Value;
28+
MuxerPath = dotNetRootOverride ?? TryFindMuxerPath();
2629
}
2730

2831
/// <summary>

0 commit comments

Comments
 (0)