Skip to content

Commit f81e66e

Browse files
committed
Improve the MSBuild task building and packaging for full .NET
The full framework console app did not reference the NS2 MSBuild task, instead having its own copy of the task class. This was unnecessary since the task class already lives in a NS2 library. Also, the .props file from the package was not referencing the MSBuild assembly from the location of the desktop assemblies, instead loading the netcore path version. This was risky since the wrong assemblies could have been loaded inadvertently. This commit improves that by conditionally importing the tasks assembly from either the desktop or the netcore locations, which would then cause any other dependencies in that folder to be resolved for the right framework.
1 parent 66c3405 commit f81e66e

File tree

4 files changed

+7
-148
lines changed

4 files changed

+7
-148
lines changed
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
33
<PropertyGroup>
4-
<ReportGeneratorAssembly>$(MSBuildThisFileDirectory)..\..\tools\netcoreapp2.1\ReportGenerator.MSBuild.dll</ReportGeneratorAssembly>
4+
<ReportGeneratorAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\..\tools\netcoreapp2.1\ReportGenerator.MSBuild.dll</ReportGeneratorAssembly>
5+
<ReportGeneratorAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\..\tools\net47\ReportGenerator.MSBuild.dll</ReportGeneratorAssembly>
56
</PropertyGroup>
67
<UsingTask TaskName="ReportGenerator" AssemblyFile="$(ReportGeneratorAssembly)" />
78
</Project>

src/ReportGenerator.Console/MSBuild/ReportGenerator.cs

-145
This file was deleted.

src/ReportGenerator.Console/ReportGenerator.Console.Net.csproj

+4-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
<Reference Include="System.Xml" />
6666
</ItemGroup>
6767
<ItemGroup>
68-
<Compile Include="MSBuild\ReportGenerator.cs" />
6968
<Compile Include="Program.cs" />
7069
<Compile Include="Properties\AssemblyInfo.cs" />
7170
</ItemGroup>
@@ -77,6 +76,10 @@
7776
<Project>{8dbcf22a-18a3-4a50-899d-8af6ed9975d0}</Project>
7877
<Name>ReportGenerator.Core</Name>
7978
</ProjectReference>
79+
<ProjectReference Include="..\ReportGenerator.MSBuild\ReportGenerator.MSBuild.csproj">
80+
<Project>{e0ac1ee8-82a3-41ee-bd42-44659cdbd333}</Project>
81+
<Name>ReportGenerator.MSBuild</Name>
82+
</ProjectReference>
8083
</ItemGroup>
8184
<ItemGroup>
8285
<Content Include="..\..\LICENSE.txt">

src/ReportGenerator.Core.Test/MsBuildTestScript.proj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="ReportGenerator">
33
<!-- Imported MSBuild tasks -->
4-
<UsingTask TaskName="ReportGenerator" AssemblyFile="$(MSBuildThisFileDirectory)..\ReportGenerator.Console.NetCore\bin\$(Configuration)\netcoreapp3.0\ReportGenerator.MSBuild.dll" />
4+
<UsingTask TaskName="ReportGenerator" AssemblyFile="$(MSBuildThisFileDirectory)..\ReportGenerator.Console\bin\$(Configuration)\ReportGenerator.MSBuild.dll" />
55

66
<Target Name="ReportGenerator">
77
<ItemGroup>

0 commit comments

Comments
 (0)