Skip to content

Commit

Permalink
Move JsonConverters and Fix Extensions to add support for ILRepack.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaffinito committed Jun 13, 2024
1 parent ff65eaf commit ed24de5
Show file tree
Hide file tree
Showing 89 changed files with 67 additions and 212 deletions.
8 changes: 0 additions & 8 deletions FullAgent.sln
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConcurrentBenchmarking", "t
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewRelic.Agent.Extensions", "src\Agent\NewRelic\Agent\Extensions\NewRelic.Agent.Extensions\NewRelic.Agent.Extensions.csproj", "{686AE051-BC8C-4AEC-803D-237AEB807CA9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewRelic.Core", "src\NewRelic.Core\NewRelic.Core.csproj", "{9784EAEA-C32F-4DC4-BD84-4075BBA541AB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{C0BB7A5D-6820-4058-AC47-0111ECC34015}"
ProjectSection(SolutionItems) = preProject
build\Common.src.props = build\Common.src.props
Expand Down Expand Up @@ -163,7 +161,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Home", "src\Agent\NewRelic\
{710C7C7A-CD27-4F94-B2D3-9804BD848D57} = {710C7C7A-CD27-4F94-B2D3-9804BD848D57}
{87EF7419-8390-49F2-8C51-4DF9B886E834} = {87EF7419-8390-49F2-8C51-4DF9B886E834}
{8D2B52DD-D45C-481D-92F0-28990F168820} = {8D2B52DD-D45C-481D-92F0-28990F168820}
{9784EAEA-C32F-4DC4-BD84-4075BBA541AB} = {9784EAEA-C32F-4DC4-BD84-4075BBA541AB}
{9C20BC4E-7A9F-4518-B3E7-C1FFD6C0EC8A} = {9C20BC4E-7A9F-4518-B3E7-C1FFD6C0EC8A}
{9E9E1367-E09E-45F9-9A01-7D4489FBCB23} = {9E9E1367-E09E-45F9-9A01-7D4489FBCB23}
{A4B357E3-9CEF-492C-A0E2-2397D15F1CD6} = {A4B357E3-9CEF-492C-A0E2-2397D15F1CD6}
Expand Down Expand Up @@ -320,10 +317,6 @@ Global
{686AE051-BC8C-4AEC-803D-237AEB807CA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{686AE051-BC8C-4AEC-803D-237AEB807CA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{686AE051-BC8C-4AEC-803D-237AEB807CA9}.Release|Any CPU.Build.0 = Release|Any CPU
{9784EAEA-C32F-4DC4-BD84-4075BBA541AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9784EAEA-C32F-4DC4-BD84-4075BBA541AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9784EAEA-C32F-4DC4-BD84-4075BBA541AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9784EAEA-C32F-4DC4-BD84-4075BBA541AB}.Release|Any CPU.Build.0 = Release|Any CPU
{33F999A9-88AE-44DE-9BAA-267CF55FACA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33F999A9-88AE-44DE-9BAA-267CF55FACA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33F999A9-88AE-44DE-9BAA-267CF55FACA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -482,7 +475,6 @@ Global
{FBD561F5-BA22-46D5-85D4-3BB24B82A85F} = {E5B988C0-5D19-407E-8210-71FFB90C579A}
{4E32935B-8C6E-4885-9B15-19D632040ABA} = {E5B988C0-5D19-407E-8210-71FFB90C579A}
{686AE051-BC8C-4AEC-803D-237AEB807CA9} = {1800B0F7-BA26-47E5-A7D4-63BC85880C99}
{9784EAEA-C32F-4DC4-BD84-4075BBA541AB} = {E3DAC9C6-AE41-4B37-A253-C621E568590E}
{33F999A9-88AE-44DE-9BAA-267CF55FACA2} = {E5B988C0-5D19-407E-8210-71FFB90C579A}
{6D177CB0-32F2-46F5-9C6A-9A6EB9F68892} = {E5B988C0-5D19-407E-8210-71FFB90C579A}
{B30142E5-36A2-4D91-A20C-4B8C9632EC41} = {E5B988C0-5D19-407E-8210-71FFB90C579A}
Expand Down
6 changes: 1 addition & 5 deletions build/ArtifactBuilder/CoreAgentComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ protected override string SourceHomeBuilderPath

protected override void CreateAgentComponents()
{
var agentDllsForExtensionDirectory = new List<string>()
{
$@"{SourceHomeBuilderPath}\extensions\NewRelic.Core.dll",
$@"{SourceHomeBuilderPath}\extensions\NewRelic.Parsing.dll"
};
var agentDllsForExtensionDirectory = new List<string>();

var storageProviders = new List<string>()
{
Expand Down
6 changes: 1 addition & 5 deletions build/ArtifactBuilder/FrameworkAgentComponents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ public FrameworkAgentComponents(string configuration, string platform, string re

protected override void CreateAgentComponents()
{
var agentDllsForExtensionDirectory = new List<string>()
{
$@"{SourceHomeBuilderPath}\extensions\NewRelic.Core.dll",
$@"{SourceHomeBuilderPath}\extensions\NewRelic.Parsing.dll"
};
var agentDllsForExtensionDirectory = new List<string>();

var storageProviders = new List<string>()
{
Expand Down
14 changes: 2 additions & 12 deletions build/build_functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,6 @@ function Copy-ExtensionsOther {

Copy-Item -Path "$RootDirectory\src\Agent\Miscellaneous\NewRelic.Providers.Wrapper.Misc.Instrumentation.xml" -Destination "$Destination\extensions" -Force
Copy-Item -Path "$RootDirectory\src\Agent\NewRelic\Agent\Core\Extension\extension.xsd" -Destination "$Destination\extensions" -Force

if ($Type -like "Framework"){
Copy-Item -Path "$RootDirectory\src\_build\AnyCPU-$Configuration\NewRelic.Core\net462-ILRepacked\NewRelic.Core.dll" -Destination "$Destination\extensions" -Force
Copy-Item -Path "$RootDirectory\src\Agent\NewRelic\Agent\Parsing\bin\$Configuration\net462\NewRelic.Parsing.dll" -Destination "$Destination\extensions" -Force
}

if ($Type -like "Core"){
Copy-Item -Path "$RootDirectory\src\_build\AnyCPU-$Configuration\NewRelic.Core\netstandard2.0-ILRepacked\NewRelic.Core.dll" -Destination "$Destination\extensions" -Force
Copy-Item -Path "$RootDirectory\src\Agent\NewRelic\Agent\Parsing\bin\$Configuration\netstandard2.0\NewRelic.Parsing.dll" -Destination "$Destination\extensions" -Force
}
}

function Copy-AgentRoot {
Expand All @@ -143,12 +133,12 @@ function Copy-AgentRoot {
Copy-Item -Path "$RootDirectory\src\Agent\NewRelic\Agent\Core\Config\Configuration.xsd" -Destination "$Destination\newrelic.xsd" -Force

if ($Type -like "Framework") {
Copy-Item -Path "$RootDirectory\src\Agent\NewRelic\Agent\Extensions\NewRelic.Agent.Extensions\bin\$Configuration\net462\NewRelic.Agent.Extensions.dll" -Destination "$Destination" -Force
Copy-Item -Path "$RootDirectory\src\_build\AnyCPU-$Configuration\NewRelic.Agent.Extensions\net462-ILRepacked\NewRelic.Agent.Extensions.dll" -Destination "$Destination" -Force
Copy-Item -Path "$RootDirectory\src\_build\AnyCPU-$Configuration\NewRelic.Agent.Core\net462-ILRepacked\NewRelic.Agent.Core.dll" -Destination "$Destination" -Force
}

if ($Type -like "Core") {
Copy-Item -Path "$RootDirectory\src\Agent\NewRelic\Agent\Extensions\NewRelic.Agent.Extensions\bin\$Configuration\netstandard2.0\NewRelic.Agent.Extensions.dll" -Destination "$Destination" -Force
Copy-Item -Path "$RootDirectory\src\_build\AnyCPU-$Configuration\NewRelic.Agent.Extensions\netstandard2.0-ILRepacked\NewRelic.Agent.Extensions.dll" -Destination "$Destination" -Force
Copy-Item -Path "$RootDirectory\src\_build\AnyCPU-$Configuration\NewRelic.Agent.Core\netstandard2.0-ILRepacked\NewRelic.Agent.Core.dll" -Destination "$Destination" -Force
Copy-Item -Path "$RootDirectory\src\Agent\Miscellaneous\core-agent-readme.md" -Destination "$Destination\README.md" -Force
}
Expand Down
15 changes: 0 additions & 15 deletions src/Agent/MsiInstaller/Installer/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,6 @@ SPDX-License-Identifier: Apache-2.0
<Component Id="BedrockWrapperComponent" Guid="{C913E912-97D1-4042-8E11-A35E04C6A6E5}">
<File Id="BedrockWrapperFile" Name="NewRelic.Providers.Wrapper.Bedrock.dll" KeyPath="yes" Source="$(var.HomeFolderPath)\extensions\NewRelic.Providers.Wrapper.Bedrock.dll" />
</Component>

<!-- Reference libraries -->
<Component Id="NewRelicCoreReferenceComponent" Guid="{C196ED1E-0FBA-4D36-9C34-E969B0C9E8C9}">
<File Id="NewRelicCoreReferenceFile" Name="NewRelic.Core.dll" KeyPath="yes" Source="$(var.HomeFolderPath)\extensions\NewRelic.Core.dll" />
</Component>
<Component Id="NewRelicParsingReferenceComponent" Guid="{2B5FA2A3-E532-48CC-8390-D023DE693F8A}">
<File Id="NewRelicParsingReferenceFile" Name="NewRelic.Parsing.dll" KeyPath="yes" Source="$(var.HomeFolderPath)\extensions\NewRelic.Parsing.dll" />
</Component>
</ComponentGroup>

<ComponentGroup Id="CoreNewRelic.Agent.Extensions" Directory="CoreProgramFilesExtensionsFolder">
Expand Down Expand Up @@ -471,13 +463,6 @@ SPDX-License-Identifier: Apache-2.0
<Component Id="CoreAwsLambdaWrapperComponent" Guid="{778F507F-97D7-48B2-BE51-46D6DAB2D234}">
<File Id="CoreAwsLambdaWrapperFile" Name="NewRelic.Providers.Wrapper.AwsLambda.dll" KeyPath="yes" Source="$(var.HomeFolderPath)_coreclr\extensions\NewRelic.Providers.Wrapper.AwsLambda.dll"/>
</Component>
<!-- Reference libraries -->
<Component Id="CoreNewRelicCoreReferenceComponent" Guid="{DD2BE979-7D4B-47EA-9FBE-F6B381D70E0B}">
<File Id="CoreNewRelicCoreReferenceFile" Name="NewRelic.Core.dll" KeyPath="yes" Source="$(var.HomeFolderPath)_coreclr\extensions\NewRelic.Core.dll" />
</Component>
<Component Id="CoreNewRelicParsingReferenceComponent" Guid="{D446845B-C0EC-4FC6-AA4B-BD92E622CE12}">
<File Id="CoreNewRelicParsingReferenceFile" Name="NewRelic.Parsing.dll" KeyPath="yes" Source="$(var.HomeFolderPath)_coreclr\extensions\NewRelic.Parsing.dll" />
</Component>
</ComponentGroup>

<!-- Wrapper Instrumentation Files-->
Expand Down
1 change: 0 additions & 1 deletion src/Agent/NewRelic/Agent/Core/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
using NewRelic.Agent.Core.Wrapper.AgentWrapperApi.Synthetics;
using NewRelic.Agent.Extensions.Helpers;
using NewRelic.Agent.Extensions.Providers.Wrapper;
using NewRelic.Core;
using NewRelic.Agent.Extensions.Logging;
using NewRelic.Agent.Core.SharedInterfaces;
using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using NewRelic.Core;
using NewRelic.Agent.Extensions.Parsing;
using NewRelic.Agent.Core.Spans;
using NewRelic.Agent.Extensions.Providers.Wrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0

using NewRelic.Agent.Core.Utilities;
using NewRelic.Core;
using NewRelic.Agent.Extensions.Logging;
using System;
using System.IO;
Expand Down
2 changes: 1 addition & 1 deletion src/Agent/NewRelic/Agent/Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="6.0.1" />
<ProjectReference Include="..\Extensions\NewRelic.Agent.Extensions\NewRelic.Agent.Extensions.csproj" />
<ProjectReference Include="$(RootProjectDirectory)\src\NewRelic.Core\NewRelic.Core.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using NewRelic.Agent.Core.Utilities;
using NewRelic.Agent.Extensions.Providers.Wrapper;
using NewRelic.Agent.Extensions.Collections;
using NewRelic.Core;
using NewRelic.Agent.Extensions.Logging;
using NewRelic.Agent.Core.SharedInterfaces;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using NewRelic.Agent.Core.ThreadProfiling;
using NewRelic.Agent.Core.Utilities;
using NewRelic.Agent.Core.WireModels;
using NewRelic.Core;
using NewRelic.Agent.Extensions.Logging;
using NewRelic.Agent.Core.SharedInterfaces;
using System;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using NewRelic.Agent.Core.ThreadProfiling;
using NewRelic.Agent.Core.Utilities;
using NewRelic.Agent.Core.WireModels;
using NewRelic.Core;
using NewRelic.Agent.Extensions.Logging;
using NewRelic.Agent.Core.SharedInterfaces;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
using NewRelic.Agent.Extensions.Providers;
using NewRelic.Agent.Extensions.Providers.Wrapper;
using NewRelic.Agent.Core.SharedInterfaces.Web;
using NewRelicCore = NewRelic.Core;
using NewRelic.Agent.Core.Labels;

namespace NewRelic.Agent.Core.DependencyInjection
Expand Down
1 change: 0 additions & 1 deletion src/Agent/NewRelic/Agent/Core/Segments/Segment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using NewRelic.Agent.Core.Aggregators;
using NewRelic.Agent.Configuration;
using System.Threading;
using NewRelic.Core;
using NewRelic.Agent.Api;
using NewRelic.Agent.Api.Experimental;
using NewRelic.Agent.Core.Spans;
Expand Down
1 change: 0 additions & 1 deletion src/Agent/NewRelic/Agent/Core/Transactions/Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
using NewRelic.Agent.Extensions.Parsing;
using NewRelic.Agent.Extensions.Providers.Wrapper;
using NewRelic.Agent.Extensions.Collections;
using NewRelic.Core;
using NewRelic.Agent.Extensions.Logging;
using NewRelic.Agent.Extensions.SystemExtensions.Collections.Generic;
using System;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

using NewRelic.Core;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand Down
1 change: 0 additions & 1 deletion src/Agent/NewRelic/Agent/Core/Utilities/HeaderEncoder.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

using NewRelic.Core;
using NewRelic.Agent.Extensions.Logging;
using Newtonsoft.Json;
using System;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

using NewRelic.Core;
using System.Text;

namespace NewRelic.Agent.Core.Utilities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Newtonsoft.Json;

namespace NewRelic.Core.JsonConverters.BedrockPayloads
namespace NewRelic.Agent.Extensions.JsonConverters.BedrockPayloads
{
public class ClaudeRequestPayload : IRequestPayload
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Linq;
using Newtonsoft.Json;

namespace NewRelic.Core.JsonConverters.BedrockPayloads
namespace NewRelic.Agent.Extensions.JsonConverters.BedrockPayloads
{
public class CohereCommandRequestPayload : IRequestPayload
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Linq;
using Newtonsoft.Json;

namespace NewRelic.Core.JsonConverters.BedrockPayloads
namespace NewRelic.Agent.Extensions.JsonConverters.BedrockPayloads
{
public class JurassicRequestPayload : IRequestPayload
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Newtonsoft.Json;

namespace NewRelic.Core.JsonConverters.BedrockPayloads
namespace NewRelic.Agent.Extensions.JsonConverters.BedrockPayloads
{
public class Llama2RequestPayload : IRequestPayload
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2020 New Relic, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

namespace NewRelic.Core.JsonConverters.BedrockPayloads
namespace NewRelic.Agent.Extensions.JsonConverters.BedrockPayloads
{
public interface IRequestPayload
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## AWS Bedrock (LLM) payloads in NewRelic.Core

These classes are used in the Bedrock instrumentation wrapper. They are placed here in NewRelic.Core.JsonConverters,
These classes are used in the Bedrock instrumentation wrapper. They are placed here in NewRelic.Agent.Extensions.JsonConverters,
rather than in the wrapper project, to avoid the wrapper having a dependency on Newtonsoft.Json.
NewRelic.Core already ILRepacks Newtonsoft.Json so it is available here for sure.
NewRelic.Agent.Extensions already ILRepacks Newtonsoft.Json so it is available here for sure.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Linq;
using Newtonsoft.Json;

namespace NewRelic.Core.JsonConverters.BedrockPayloads
namespace NewRelic.Agent.Extensions.JsonConverters.BedrockPayloads
{
public class TitanRequestPayload : IRequestPayload
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.Collections.Generic;

namespace NewRelic.Core.JsonConverters.LambdaPayloads
namespace NewRelic.Agent.Extensions.JsonConverters.LambdaPayloads
{

public class SnsMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Newtonsoft.Json;

namespace NewRelic.Core.JsonConverters
namespace NewRelic.Agent.Extensions.JsonConverters
{
public static class WrapperHelpers
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using System.Linq;
using NewRelic.Agent.Api;
using NewRelic.Agent.Extensions.Providers.Wrapper;
using NewRelic.Core.JsonConverters;
using NewRelic.Core.JsonConverters.LambdaPayloads;
using NewRelic.Agent.Extensions.JsonConverters;
using NewRelic.Agent.Extensions.JsonConverters.LambdaPayloads;

namespace NewRelic.Agent.Extensions.Lambda;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<RootNamespace>NewRelic.Agent.Extensions</RootNamespace>
<Description>Extensions for the New Relic .NET Agent</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IntermediateOutputPath>$(MSBuildThisFileDirectory)..\..\..\..\..\_build\$(Platform)-$(Configuration)\$(AssemblyName)\obj</IntermediateOutputPath>
<OutputPath>$(MSBuildThisFileDirectory)..\..\..\..\..\_build\$(Platform)-$(Configuration)\$(AssemblyName)\</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration'=='Debug'">
Expand All @@ -14,11 +17,14 @@
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(RootProjectDirectory)\src\NewRelic.Core\NewRelic.Core.csproj" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="ILRepack" Version="2.0.33">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
Expand All @@ -32,4 +38,43 @@
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
</ItemGroup>

<Target Name="ILRepack" AfterTargets="Build" Condition="'$(TargetFramework)' != ''">
<ItemGroup>
<PossibleRefsForILRepack Include="$(OutputPath)*.dll" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<ILRepackInclude Include="@(PossibleRefsForILRepack)" Condition="'%(FileName)' == 'Newtonsoft.Json'" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<ILRepackInclude Include="@(PossibleRefsForILRepack)" Condition="'%(FileName)' == 'Newtonsoft.Json'" />
</ItemGroup>

<PropertyGroup>
<ILRepackIncludeCount Condition="'$(TargetFramework)' == 'net462'">1</ILRepackIncludeCount>
<ILRepackIncludeCount Condition="'$(TargetFramework)' == 'netstandard2.0'">1</ILRepackIncludeCount>
</PropertyGroup>

<Error Text="ILRepack of $(AssemblyName) ($(TargetFramework)) failed. A dependency is missing. Expected $(ILRepackIncludeCount) dependencies but found @(ILRepackInclude-&gt;Count())." Condition="@(ILRepackInclude-&gt;Count()) != $(ILRepackIncludeCount)" />

<ItemGroup>
<ILRepackExclude Include="@(PossibleRefsForILRepack)" Exclude="@(ILRepackInclude)" />
</ItemGroup>

<Message Importance="High" Text="ILRepack Include: %(ILRepackInclude.FullPath)" />
<Message Importance="High" Text="ILRepack Exclude: %(ILRepackExclude.FullPath)" />

<PropertyGroup>
<ILRepackSearchDirOutputPath>$([System.String]::new("$(OutputPath)").Trim('\'))</ILRepackSearchDirOutputPath>
</PropertyGroup>

<PropertyGroup>
<ILRepackCommand>"$(ILRepack)" /parallel /internalize /norepackres /keepotherversionreferences /keyfile:"$(AssemblyOriginatorKeyFile)" /lib:"$(ILRepackSearchDirOutputPath)" /out:"$(OutputPath)..\$(TargetFramework)-ILRepacked\$(AssemblyName).dll" "$(TargetPath)" "@(ILRepackInclude, '" "')"</ILRepackCommand>
</PropertyGroup>

<Message Importance="High" Text="Executing ILRepack.exe for $(TargetFramework) build: $(ILRepackCommand)" />
<Exec Command="$(ILRepackCommand)" />
</Target>
</Project>
Loading

0 comments on commit ed24de5

Please sign in to comment.