Skip to content

Commit

Permalink
#335: Workaround for MSBuild task in .NET Core SDK 3.1.20x
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpalme committed Mar 29, 2020
1 parent 98539ac commit b39b75d
Show file tree
Hide file tree
Showing 21 changed files with 125 additions and 38 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
disable.coverage.autogenerate: 'true'
version: '4.5.2'
version: '4.5.3'

# Prepare
steps:
Expand Down
Binary file modified docs/resources/SampleReports.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion src/AzureDevopsTask/ReportGenerator/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"version": {
"Major": 4,
"Minor": 5,
"Patch": 2
"Patch": 3
},
"instanceNameFormat": "ReportGenerator",
"groups": [
Expand Down
2 changes: 1 addition & 1 deletion src/AzureDevopsTask/vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "reportgenerator",
"name": "ReportGenerator",
"version": "4.5.2",
"version": "4.5.3",
"publisher": "Palmmedia",
"public": true,
"targets": [
Expand Down
4 changes: 4 additions & 0 deletions src/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ For further details take a look at LICENSE.txt.

CHANGELOG

4.5.3.0

* Fix: Issue #335: Workaround for MSBuild task in .NET Core SDK 3.1.20x

4.5.2.0

* Fix: Issue #331: Fixed string encoding in JsonSummary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<AssemblyName>ReportGenerator</AssemblyName>
<RootNamespace>Palmmedia.ReportGenerator</RootNamespace>
<StartupObject>Palmmedia.ReportGenerator.Console.NetCore.Program</StartupObject>
<AssemblyVersion>4.5.2.0</AssemblyVersion>
<FileVersion>4.5.2.0</FileVersion>
<AssemblyVersion>4.5.3.0</AssemblyVersion>
<FileVersion>4.5.3.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/ReportGenerator.Console/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.5.2.0")]
[assembly: AssemblyFileVersion("4.5.2.0")]
[assembly: AssemblyVersion("4.5.3.0")]
[assembly: AssemblyFileVersion("4.5.3.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core">
<Version>16.0.461</Version>
<Version>16.5.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/ReportGenerator.Core.Test/MsBuildTest.cs
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()
{


}
}
}
13 changes: 13 additions & 0 deletions src/ReportGenerator.Core.Test/MsBuildTestScript.proj
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>
20 changes: 20 additions & 0 deletions src/ReportGenerator.Core.Test/MsBuildTestScript_Core.proj
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>
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>Palmmedia.ReportGenerator.Core.Test</RootNamespace>
<AssemblyVersion>4.5.2.0</AssemblyVersion>
<FileVersion>4.5.2.0</FileVersion>
<AssemblyVersion>4.5.3.0</AssemblyVersion>
<FileVersion>4.5.3.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -26,6 +26,7 @@
<ItemGroup>
<ProjectReference Include="..\ReportGenerator.Core\ReportGenerator.Core.csproj" />
<ProjectReference Include="..\ReportGenerator.DotnetCorePluginLoader\ReportGenerator.DotnetCorePluginLoader.csproj" />
<ProjectReference Include="..\ReportGenerator.MSBuild\ReportGenerator.MSBuild.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/ReportGenerator.Core/Plugin/ReflectionPluginLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ private IAssemblyLoader CreateAssemblyLoader()

var dotnetCorePluginLoaderAssembly = Assembly.LoadFrom(path);
var assemblyLoaderType = dotnetCorePluginLoaderAssembly.GetExportedTypes()
.Where(t => typeof(IAssemblyLoader).IsAssignableFrom(t) && t.IsClass && !t.IsAbstract)
.Where(t => t.FullName == "ReportGenerator.DotnetCorePluginLoader.DotNetCoreAssemblyLoader" && t.IsClass && !t.IsAbstract)
.Single();
return (IAssemblyLoader)Activator.CreateInstance(assemblyLoaderType);
return new ReflectionWrapperAssemblyLoader(Activator.CreateInstance(assemblyLoaderType));
}

return new DefaultAssemblyLoader();
Expand Down
48 changes: 48 additions & 0 deletions src/ReportGenerator.Core/Plugin/ReflectionWrapperAssemblyLoader.cs
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;
}
}
}
4 changes: 2 additions & 2 deletions src/ReportGenerator.Core/ReportGenerator.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AssemblyName>ReportGenerator.Core</AssemblyName>
<AssemblyVersion>4.5.2.0</AssemblyVersion>
<FileVersion>4.5.2.0</FileVersion>
<AssemblyVersion>4.5.3.0</AssemblyVersion>
<FileVersion>4.5.3.0</FileVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<AssemblyName>dotnet-reportgenerator</AssemblyName>
<RootNamespace>Palmmedia.ReportGenerator</RootNamespace>
<StartupObject>Palmmedia.ReportGenerator.DotnetCliTool.Program</StartupObject>
<AssemblyVersion>4.5.2.0</AssemblyVersion>
<FileVersion>4.5.2.0</FileVersion>
<AssemblyVersion>4.5.3.0</AssemblyVersion>
<FileVersion>4.5.3.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RootNamespace>ReportGenerator.DotnetCorePluginLoader</RootNamespace>
<AssemblyVersion>4.5.2.0</AssemblyVersion>
<FileVersion>4.5.2.0</FileVersion>
<AssemblyVersion>4.5.3.0</AssemblyVersion>
<FileVersion>4.5.3.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<AssemblyName>ReportGenerator</AssemblyName>
<RootNamespace>Palmmedia.ReportGenerator</RootNamespace>
<StartupObject>Palmmedia.ReportGenerator.DotnetGlobalTool.Program</StartupObject>
<AssemblyVersion>4.5.2.0</AssemblyVersion>
<FileVersion>4.5.2.0</FileVersion>
<AssemblyVersion>4.5.3.0</AssemblyVersion>
<FileVersion>4.5.3.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/ReportGenerator.MSBuild/ReportGenerator.MSBuild.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<RootNamespace>Palmmedia.ReportGenerator.MSBuild</RootNamespace>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AssemblyVersion>4.5.2.0</AssemblyVersion>
<FileVersion>4.5.2.0</FileVersion>
<AssemblyVersion>4.5.3.0</AssemblyVersion>
<FileVersion>4.5.3.0</FileVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.0.461" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 0 additions & 14 deletions src/ReportGenerator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Reports", "Reports", "{8775
Testprojects\FSharp\Reports\VisualStudio2013.coveragexml = Testprojects\FSharp\Reports\VisualStudio2013.coveragexml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_CSharp", "Testprojects\CSharp\Project\Test_CSharp.csproj", "{E035281E-8AB7-4A3E-98D2-C14DF6E9B741}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Test_FSharp", "Testprojects\FSharp\Project\Test_FSharp.fsproj", "{953D4A9C-5271-4A6D-876A-7E41B93BEE77}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Java", "Java", "{89813866-CE17-47E5-BCA3-4740F8624BA5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Project", "Project", "{F02BAC2E-AD05-4AE9-B37B-A6B7CA732FBA}"
Expand Down Expand Up @@ -149,14 +145,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E035281E-8AB7-4A3E-98D2-C14DF6E9B741}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E035281E-8AB7-4A3E-98D2-C14DF6E9B741}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E035281E-8AB7-4A3E-98D2-C14DF6E9B741}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E035281E-8AB7-4A3E-98D2-C14DF6E9B741}.Release|Any CPU.Build.0 = Release|Any CPU
{953D4A9C-5271-4A6D-876A-7E41B93BEE77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{953D4A9C-5271-4A6D-876A-7E41B93BEE77}.Debug|Any CPU.Build.0 = Debug|Any CPU
{953D4A9C-5271-4A6D-876A-7E41B93BEE77}.Release|Any CPU.ActiveCfg = Release|Any CPU
{953D4A9C-5271-4A6D-876A-7E41B93BEE77}.Release|Any CPU.Build.0 = Release|Any CPU
{8DBCF22A-18A3-4A50-899D-8AF6ED9975D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8DBCF22A-18A3-4A50-899D-8AF6ED9975D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8DBCF22A-18A3-4A50-899D-8AF6ED9975D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -196,8 +184,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{792589C7-7E2C-4C31-9FB3-A64F85BDF826} = {B27F2CDF-8E01-4D2C-9A26-972F02A0EFB6}
{8775E975-19C9-4F40-869B-04A8488AECC3} = {9223804A-D678-4EE8-BD89-19A6114DB86F}
{E035281E-8AB7-4A3E-98D2-C14DF6E9B741} = {B27F2CDF-8E01-4D2C-9A26-972F02A0EFB6}
{953D4A9C-5271-4A6D-876A-7E41B93BEE77} = {9223804A-D678-4EE8-BD89-19A6114DB86F}
{F02BAC2E-AD05-4AE9-B37B-A6B7CA732FBA} = {89813866-CE17-47E5-BCA3-4740F8624BA5}
{654FDEDF-31DE-47E4-A02E-F42DB1ACC722} = {89813866-CE17-47E5-BCA3-4740F8624BA5}
{1749EF69-D43F-4874-8290-8134B80D65E5} = {F02BAC2E-AD05-4AE9-B37B-A6B7CA732FBA}
Expand Down
2 changes: 1 addition & 1 deletion src/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<!-- Version, adjust before build -->
<PropertyGroup>
<Version>4.5.2</Version>
<Version>4.5.3</Version>
</PropertyGroup>

<!-- Tools -->
Expand Down

0 comments on commit b39b75d

Please sign in to comment.