diff --git a/src/tools/illink/src/ILLink.Tasks/LinkTask.cs b/src/tools/illink/src/ILLink.Tasks/LinkTask.cs index 979d5599fdab8..a14f775ebe451 100644 --- a/src/tools/illink/src/ILLink.Tasks/LinkTask.cs +++ b/src/tools/illink/src/ILLink.Tasks/LinkTask.cs @@ -270,11 +270,7 @@ public string ILLinkPath { #pragma warning restore IL3000 // Avoid accessing Assembly file path when publishing as a single file // IL Linker always runs on .NET Core, even when using desktop MSBuild to host ILLink.Tasks. - string path = Path.Combine (Path.GetDirectoryName (taskDirectory), "net", "illink.dll"); - - Log.LogMessage(MessageImportance.Normal, $"ILLink.Tasks path: {path}"); - - _illinkPath = path; + _illinkPath = Path.Combine (Path.GetDirectoryName (taskDirectory), "net", "illink.dll"); return _illinkPath; } @@ -289,7 +285,10 @@ private static string Quote (string path) protected override string GenerateCommandLineCommands () { var args = new StringBuilder (); - args.Append (Quote (ILLinkPath)); + var path = ILLinkPath; + args.Append (Quote (path)); + Log.LogMessage(MessageImportance.Normal, $"ILLink.Tasks path: {path}"); + return args.ToString (); }