-
-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#335: Workaround for MSBuild task in .NET Core SDK 3.1.20x
- Loading branch information
1 parent
98539ac
commit b39b75d
Showing
21 changed files
with
125 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Xunit; | ||
|
||
namespace Palmmedia.ReportGenerator.Core.Test | ||
{ | ||
public class MsBuildTest | ||
{ | ||
|
||
[Fact] | ||
public void ExecuteMSBuildScript() | ||
{ | ||
|
||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="ReportGenerator"> | ||
<!-- Imported MSBuild tasks --> | ||
<UsingTask TaskName="ReportGenerator" AssemblyFile="..\ReportGenerator.MSBuild\bin\$(Configuration)\ReportGenerator.MSBuild.dll" /> | ||
|
||
<Target Name="ReportGenerator"> | ||
<ItemGroup> | ||
<CoverageFiles Include="..\Testprojects\CSharp\Reports\Opencover.xml" /> | ||
</ItemGroup> | ||
|
||
<ReportGenerator ReportFiles="@(CoverageFiles)" ReportTypes="Html" TargetDirectory="bin\$(Configuration)\report" AssemblyFilters="-Moq;-xunit*" HistoryDirectory="bin\$(Comnfiguration)\history" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="ReportGenerator"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<!-- Imported MSBuild tasks --> | ||
<ItemGroup> | ||
<PackageReference Include="ReportGenerator" Version="4.5.2" /> | ||
</ItemGroup> | ||
|
||
<Target Name="ReportGenerator"> | ||
<ItemGroup> | ||
<CoverageFiles Include="..\Testprojects\CSharp\Reports\Opencover.xml" /> | ||
</ItemGroup> | ||
|
||
<ReportGenerator ReportFiles="@(CoverageFiles)" ReportTypes="Html" TargetDirectory="bin\$(Configuration)\report" AssemblyFilters="-Moq;-xunit*" HistoryDirectory="bin\$(Comnfiguration)\history" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/ReportGenerator.Core/Plugin/ReflectionWrapperAssemblyLoader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace Palmmedia.ReportGenerator.Core.Plugin | ||
{ | ||
/// <summary> | ||
/// This wrapper was introduced as a workaround in .NET Core SDK 3.1.20x. | ||
/// Casting types from external DLLs fails within MSBuild. | ||
/// See: | ||
/// https://github.com/danielpalme/ReportGenerator/issues/335. | ||
/// https://github.com/dotnet/sdk/issues/11043. | ||
/// </summary> | ||
public class ReflectionWrapperAssemblyLoader : IAssemblyLoader | ||
{ | ||
/// <summary> | ||
/// The <see cref="IAssemblyLoader"/> to wrap. | ||
/// </summary> | ||
private readonly object assemblyLoader; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ReflectionWrapperAssemblyLoader" /> class. | ||
/// </summary> | ||
/// <param name="assemblyLoader">The <see cref="IAssemblyLoader"/> to wrap.</param> | ||
public ReflectionWrapperAssemblyLoader(object assemblyLoader) | ||
{ | ||
if (assemblyLoader == null) | ||
{ | ||
throw new ArgumentNullException(nameof(assemblyLoader)); | ||
} | ||
|
||
this.assemblyLoader = assemblyLoader; | ||
} | ||
|
||
/// <summary> | ||
/// Loads the assembly with the given name. | ||
/// </summary> | ||
/// <param name="name">The name of the assembly.</param> | ||
/// <returns>The assembly.</returns> | ||
public Assembly Load(string name) | ||
{ | ||
var assembly = this.assemblyLoader.GetType() | ||
.GetMethod(nameof(this.Load)) | ||
.Invoke(this.assemblyLoader, new[] { name }); | ||
|
||
return (Assembly)assembly; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters