Skip to content

Commit 25308bf

Browse files
keegan-carusoKeegan Caruso
andauthored
Native AOT projects should also copy SettingsWeWantToCopy (#2665)
Co-authored-by: Keegan Caruso <[email protected]>
1 parent b9d69a4 commit 25308bf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/BenchmarkDotNet/Toolchains/NativeAot/Generator.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using System.Linq;
55
using System.Text;
6+
using System.Xml;
67
using BenchmarkDotNet.ConsoleArguments;
78
using BenchmarkDotNet.Detectors;
89
using BenchmarkDotNet.Detectors.Cpu;
@@ -155,8 +156,20 @@ private string GenerateProjectForNuGetBuild(BuildPartition buildPartition, Artif
155156
<ItemGroup>
156157
{string.Join(Environment.NewLine, GetRdXmlFiles(buildPartition.RepresentativeBenchmarkCase.Descriptor.Type, logger).Select(file => $"<RdXmlFile Include=\"{file}\" />"))}
157158
</ItemGroup>
159+
{GetCustomProperties(buildPartition, logger)}
158160
</Project>";
159161

162+
private string GetCustomProperties(BuildPartition buildPartition, ILogger logger)
163+
{
164+
var projectFile = GetProjectFilePath(buildPartition.RepresentativeBenchmarkCase.Descriptor.Type, logger);
165+
var xmlDoc = new XmlDocument();
166+
xmlDoc.Load(projectFile.FullName);
167+
168+
(string customProperties, _) = GetSettingsThatNeedToBeCopied(xmlDoc, projectFile);
169+
return customProperties;
170+
}
171+
172+
160173
private string GetILCompilerPackageReference()
161174
=> string.IsNullOrEmpty(ilCompilerVersion) ? "" : $@"<PackageReference Include=""Microsoft.DotNet.ILCompiler"" Version=""{ilCompilerVersion}"" />";
162175

0 commit comments

Comments
 (0)