in plugin-dotnet-agent/src/main/csharp/TeamCity.Dotnet.TestSuppressor/TeamCity.Dotnet.TestSuppressor/Domain/Targeting/Strategies/MsBuildBinlogTargetResolvingStrategy.cs [31:80]
public override IEnumerable<(IFileSystemInfo, TargetType)> Resolve(string target)
{
_logger.LogInformation("Resolving target MSBuild .binlog file: {Target}", target);
var targetPathSystemInfo = TryToGetTargetFile(target);
if (targetPathSystemInfo == null)
{
_logger.LogWarning("Invalid MSBuild .binlog target: {Target}", target);
yield break;
}
var binlogFile = targetPathSystemInfo as IFileInfo;
var outputAssemblyPathsResult = GetOutputAssemblyPaths(binlogFile!);
if (outputAssemblyPathsResult.IsError)
{
_logger.LogWarning(
outputAssemblyPathsResult.ErrorValue,
"Target MSBuild .binlog {TargetProject} is invalid: {Reason}",
binlogFile!.FullName,
outputAssemblyPathsResult.ErrorValue.Message
);
yield break;
}
_logger.LogDebug(
"Resolved {AssembliesCount} assemblies by target MSBuild .binlog file: {Target}",
outputAssemblyPathsResult.Value.Count(),
target
);
foreach (var outputAssemblyPath in outputAssemblyPathsResult.Value)
{
var assemblyFileInfoResult = FileSystem.TryGetFileInfo(outputAssemblyPath!);
if (assemblyFileInfoResult.IsError)
{
_logger.LogWarning(
assemblyFileInfoResult.ErrorValue,
"Target MSBuild .binlog output file {OutputAssemblyPath} does not exist",
outputAssemblyPath
);
yield break;
}
var assemblyFileInfo = assemblyFileInfoResult.Value;
_logger.LogInformation("Resolved assembly by target MSBuild .binlog file: {Assembly}", assemblyFileInfo.FullName);
yield return (assemblyFileInfo, TargetType.Assembly);
}
}