Skip to content

Commit 2dd6989

Browse files
committed
Undo the assembly merge from #383
1 parent 1c51d51 commit 2dd6989

File tree

7 files changed

+33
-90
lines changed

7 files changed

+33
-90
lines changed

src/xunit.runner.visualstudio/VsTestRunner.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -638,30 +638,6 @@ public static IReadOnlyList<IRunnerReporter> GetAvailableRunnerReporters(
638638
logger.LogWarning(message);
639639
}
640640

641-
// Look for runners that might be embedded in ourselves (because of ILRepack). This is what the code
642-
// in RunnerReporterUtility.GetAvailableRunnerReporters does after it finds a target assembly.
643-
foreach (var type in adapterAssembly.GetTypes())
644-
{
645-
if (type is null || type.IsAbstract || !type.GetInterfaces().Any(t => t == typeof(IRunnerReporter)))
646-
continue;
647-
648-
try
649-
{
650-
var ctor = type.GetConstructor(new Type[0]);
651-
if (ctor is null)
652-
{
653-
logger?.LogWarning($"Type '{type.FullName ?? type.Name}' in the adapter assembly appears to be a runner reporter, but does not have an empty constructor.");
654-
continue;
655-
}
656-
657-
result.Add((IRunnerReporter)ctor.Invoke(new object[0]));
658-
}
659-
catch (Exception ex)
660-
{
661-
logger?.LogWarning($"Exception thrown while inspecting type '{type.FullName ?? type.Name}' in the adapter assembly:{Environment.NewLine}{ex}");
662-
}
663-
}
664-
665641
return result;
666642
}
667643

src/xunit.runner.visualstudio/build/xunit.runner.visualstudio.desktop.props

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1212
<Visible>False</Visible>
1313
</None>
14+
<None Include="$(MSBuildThisFileDirectory)xunit.runner.reporters.net452.dll">
15+
<Link>xunit.runner.reporters.net452.dll</Link>
16+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
17+
<Visible>False</Visible>
18+
</None>
19+
<None Include="$(MSBuildThisFileDirectory)xunit.runner.utility.net452.dll">
20+
<Link>xunit.runner.utility.net452.dll</Link>
21+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
22+
<Visible>False</Visible>
23+
</None>
1424
<ProjectCapability Include="TestContainer" />
1525
</ItemGroup>
1626
</Project>

src/xunit.runner.visualstudio/build/xunit.runner.visualstudio.dotnetcore.props

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
77
<Visible>False</Visible>
88
</None>
9+
<None Include="$(MSBuildThisFileDirectory)xunit.runner.reporters.netcoreapp10.dll">
10+
<Link>xunit.runner.reporters.netcoreapp10.dll</Link>
11+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
12+
<Visible>False</Visible>
13+
</None>
14+
<None Include="$(MSBuildThisFileDirectory)xunit.runner.utility.netcoreapp10.dll">
15+
<Link>xunit.runner.utility.netcoreapp10.dll</Link>
16+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
17+
<Visible>False</Visible>
18+
</None>
919
<ProjectCapability Include="TestContainer" />
1020
</ItemGroup>
1121
</Project>

src/xunit.runner.visualstudio/xunit.runner.visualstudio.csproj

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="$(MicrosoftTestPlatformObjectModelVersion)" PrivateAssets="All" />
2323
<PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="$(TunnelVisionLabsReferenceAssemblyAnnotatorVersion)" PrivateAssets="All" />
2424
<PackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersVersion)" PrivateAssets="All" />
25-
<PackageReference Include="xunit.runner.reporters" Version="$(XunitVersion)" PrivateAssets="All" />
25+
<PackageReference Include="xunit.runner.reporters" Version="$(XunitVersion)" />
2626
</ItemGroup>
2727

2828
<!-- Support deterministic builds (via https://github.com/clairernovotny/DeterministicBuilds) -->
@@ -56,47 +56,9 @@
5656
Configuration=$(Configuration);
5757
GitCommitId=$(GitCommitId);
5858
PackageVersion=$(PackageVersion);
59+
XunitVersion=$(XunitVersion);
5960
</NuspecProperties>
6061
</PropertyGroup>
6162
</Target>
6263

63-
<!-- ILRepack support -->
64-
<Target Name="ILRepack" AfterTargets="Build" Condition=" '$(TargetFramework)' != '' ">
65-
<PropertyGroup>
66-
<OutputAssembly>$([System.IO.Path]::Combine($(TargetDir), "merged", "$(TargetFileName)"))</OutputAssembly>
67-
</PropertyGroup>
68-
69-
<Message Text="$(TargetName) -&gt; $(OutputAssembly)" Importance="High" />
70-
<CallTarget Targets="ILRepackConditional" />
71-
</Target>
72-
73-
<Target Name="ILRepackConditional" Inputs="$(TargetPath)" Outputs="$(TargetDir)merged\$(TargetFileName)">
74-
<ItemGroup>
75-
<ILRepackExclusions Include="$(OutputPath)*.abstractions.dll;$(OutputPath)Microsoft.*.dll;$(OutputPath)netstand*.dll;$(OutputPath)NuGet.*.dll;$(OutputPath)System.*.dll" />
76-
</ItemGroup>
77-
<ItemGroup>
78-
<Assemblies Include="$(TargetDir)*.dll;$(TargetPath)" Exclude="@(ILRepackExclusions)" />
79-
</ItemGroup>
80-
81-
<MakeDir Directories="$(TargetDir)premerge;$(TargetDir)merged" />
82-
<!-- We copy assemblies into a 'premerge' folder and merge from there, because of this issue: https://github.com/gluck/il-repack/issues/283 -->
83-
<Copy SourceFiles="@(Assemblies)" DestinationFolder="$(TargetDir)premerge" />
84-
85-
<PropertyGroup>
86-
<ILRepackExe>$([System.IO.Path]::Combine($(NuGetPackageRoot), "ilrepack.msbuild.task", $(ILRepackVersion), "tools", "ilrepack.exe"))</ILRepackExe>
87-
<ILRepackExe Condition=" '$(OS)' != 'Windows_NT' ">mono $(ILRepackExe)</ILRepackExe>
88-
<MainAssembly>$([System.IO.Path]::Combine($(TargetDir), "premerge", "$(TargetFileName)"))</MainAssembly>
89-
<OutputAssembly>$([System.IO.Path]::Combine($(TargetDir), "merged", "$(TargetFileName)"))</OutputAssembly>
90-
</PropertyGroup>
91-
92-
<ItemGroup>
93-
<OutputsToCopy Include="$(TargetDir)*.config;@(ILRepackExclusions)" />
94-
<ILRepackDependencies Include="$(TargetDir)premerge\*.dll" Exclude="$(MainAssembly)" />
95-
</ItemGroup>
96-
97-
<Copy SourceFiles="@(OutputsToCopy)" DestinationFolder="$(TargetDir)merged" />
98-
<Exec StandardOutputImportance="low" Command="$(ILRepackExe) -internalize -ndebug -lib:$(TargetDir) -out:$(OutputAssembly) $(MainAssembly) @(ILRepackDependencies, ' ')" />
99-
<RemoveDir Directories="$(TargetDir)premerge" />
100-
</Target>
101-
10264
</Project>

src/xunit.runner.visualstudio/xunit.runner.visualstudio.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
<file target="_content\" src="..\..\logo-128-transparent.png" />
2828
<file target="_content\" src="..\..\README.md" />
2929

30-
<file target="build\net462\" src="bin\$Configuration$\net462\merged\xunit.*.dll" />
30+
<file target="build\net462\" src="bin\$Configuration$\net462\xunit.*.dll" />
3131
<file target="build\net462\xunit.runner.visualstudio.props" src="build\xunit.runner.visualstudio.desktop.props" />
3232

33-
<file target="build\net6.0\" src="bin\$Configuration$\net6.0\merged\xunit.*.dll" />
33+
<file target="build\net6.0\" src="bin\$Configuration$\net6.0\xunit.*.dll" />
3434
<file target="build\net6.0\xunit.runner.visualstudio.props" src="build\xunit.runner.visualstudio.dotnetcore.props" />
3535

3636
<file target="lib\net462\" src="build\_._" />

test/test.harness/test.harness.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
<TargetFrameworks>net462;net472;net6.0</TargetFrameworks>
55
</PropertyGroup>
66

7+
<ItemGroup>
8+
<ProjectReference Include="..\..\src\xunit.runner.visualstudio\xunit.runner.visualstudio.csproj" />
9+
</ItemGroup>
10+
711
<ItemGroup>
812
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
913
<PackageReference Include="xunit" Version="$(XunitVersion)" />

test/test.testcasefilter/test.testcasefilter.csproj

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,12 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="xunit" Version="$(XunitVersion)" />
8+
<ProjectReference Include="..\..\src\xunit.runner.visualstudio\xunit.runner.visualstudio.csproj" />
99
</ItemGroup>
1010

11-
<!--
12-
To verify that the tests can run with the ILRepack'd binaries (per the bug in https://github.com/xunit/visualstudio.xunit/issues/384),
13-
run the following commands:
14-
15-
$ dotnet build
16-
$ dotnet build test\test.testcasefilter /t:Test
17-
18-
In the success case, the output should contain JSON messages, like this:
19-
20-
[xUnit.net 00:00:00.00] {"message":"testCollectionStarting","flowId":"b41f5cce12d44b4aa70bc54778922c35","assembly":"test.testcasefilter, Version=99.99.99.0, Culture=neutral, PublicKeyToken=null","collectionName":"Test collection for test.testcasefilter.Tests","collectionId":"c88827b8-7f3a-43d4-baea-1905ce8b521f"}
21-
22-
In the failure case, the output will include a warning about an unknown "json" reporter switch:
23-
24-
[xUnit.net 00:00:00.00] Could not find requested reporter 'json'
25-
-->
26-
27-
<Target Name="Test">
28-
<ItemGroup>
29-
<RunnerBinaries Include="..\..\src\xunit.runner.visualstudio\bin\Debug\net462\merged\xunit*.dll" />
30-
</ItemGroup>
31-
<Copy SourceFiles="@(RunnerBinaries)" DestinationFolder="bin\Debug\net462" />
32-
<Exec Command="dotnet vstest bin\Debug\net462\test.testcasefilter.dll /logger:console;verbosity=normal -- xUnit.ReporterSwitch=json" />
33-
</Target>
11+
<ItemGroup>
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNetTestSdkVersion)" />
13+
<PackageReference Include="xunit" Version="$(XunitVersion)" />
14+
</ItemGroup>
3415

3516
</Project>

0 commit comments

Comments
 (0)